WordPress.org

Make WordPress Core

Ticket #34359: 34359.2.patch

File 34359.2.patch, 1.0 KB (added by kovshenin, 6 years ago)
  • src/wp-includes/functions.php

     
    18001800 * 'error' - set to false.
    18011801 *
    18021802 * @since 2.0.0
     1803 * @uses _wp_upload_dir()
    18031804 *
    18041805 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
    18051806 * @return array See above for description.
    18061807 */
    18071808function wp_upload_dir( $time = null ) {
     1809        static $cache = array();
     1810        $key = sprintf( '%d-%s', get_current_blog_id(), (string) $time );
     1811
     1812        if ( empty( $cache[ $key ] ) ) {
     1813                $cache[ $key ] = _wp_upload_dir( $time );
     1814        }
     1815
     1816        return $cache[ $key ];
     1817}
     1818
     1819/**
     1820 * A non-cached version of wp_upload_dir().
     1821 *
     1822 * @access private
     1823 *
     1824 * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
     1825 * @return array See wp_upload_dir()
     1826 */
     1827function _wp_upload_dir( $time = null ) {
    18081828        $siteurl = get_option( 'siteurl' );
    18091829        $upload_path = trim( get_option( 'upload_path' ) );
    18101830