{"id":15837,"date":"2010-03-23T22:29:27","date_gmt":"2010-03-23T22:29:27","guid":{"rendered":"https:\/\/ru.wordpress.org\/support\/2010\/03\/23\/%d0%a3%d0%b4%d0%b0%d0%bb%d0%b5%d0%bd%d0%b8%d0%b5-%d0%bb%d0%b8%d1%88%d0%bd%d0%b8%d1%85-%d0%b8%d0%b7%d0%be%d0%b1%d1%80%d0%b0%d0%b6%d0%b5%d0%bd%d0%b8%d0%b9\/"},"modified":"2010-03-23T22:29:27","modified_gmt":"2010-03-23T22:29:27","slug":"%d0%a3%d0%b4%d0%b0%d0%bb%d0%b5%d0%bd%d0%b8%d0%b5-%d0%bb%d0%b8%d1%88%d0%bd%d0%b8%d1%85-%d0%b8%d0%b7%d0%be%d0%b1%d1%80%d0%b0%d0%b6%d0%b5%d0%bd%d0%b8%d0%b9","status":"closed","type":"topic","link":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%a3%d0%b4%d0%b0%d0%bb%d0%b5%d0%bd%d0%b8%d0%b5-%d0%bb%d0%b8%d1%88%d0%bd%d0%b8%d1%85-%d0%b8%d0%b7%d0%be%d0%b1%d1%80%d0%b0%d0%b6%d0%b5%d0%bd%d0%b8%d0%b9\/","title":{"rendered":"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439"},"content":{"rendered":"<p><strong>\u0414\u043e\u0431\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0442\u043e\u043a!<br \/>\n\u041f\u043e\u043c\u043e\u0433\u0438\u0442\u0435 \u0440\u0435\u0448\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<\/strong><br \/>\n\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u043d\u043e\u0432\u043e\u0441\u0442\u0435\u0439, \u0432 \u043f\u0430\u043f\u043a\u0435 cache \u0433\u0440\u0430\u0431\u0435\u0440\u0430 wp-o-matic (\u043d\u0435 WP) \u0441\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0420\u0443\u0447\u043d\u0430\u044f \u0447\u0438\u0441\u0442\u043a\u0430 \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442, \u0430 \u0434\u0430\u0436\u0435 \u0432\u0440\u0435\u0434\u0438\u0442, \u0442.\u043a. \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<br \/>\n\u041f\u0430\u043f\u043a\u0430 wp-o-matic\/cache \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 1Gb!<br \/>\n\u041a\u044d\u0448 \u0443\u0436\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b, \u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441 uploads:<br \/>\ndefine(&#8216;UPLOADS&#8217;, &#8216;wp-content\/plugins\/wp-o-matic\/cache&#8217;);<br \/>\n\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439,\u043d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<br \/>\n\u041d\u0430\u0434\u043e \u0443\u0431\u0440\u0430\u0442\u044c 2010\/03 \u0438 \u0442.\u043f. \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043f\u043e\u0434\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439!<br \/>\n\u041d\u0430\u0448\u0435\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435, \u043d\u043e \u043d\u0438 \u043a\u0430\u043a \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<pre><code>\/**\n * Get an array containing the current upload directory&#39;s path and url.\n *\n * Checks the &#39;upload_path&#39; option, which should be from the web root folder,\n * and if it isn&#39;t empty it will be used. If it is empty, then the path will be\n * &#39;WP_CONTENT_DIR\/uploads&#39;. If the &#39;UPLOADS&#39; constant is defined, then it will\n * override the &#39;upload_path&#39; option and &#39;WP_CONTENT_DIR\/uploads&#39; path.\n *\n * The upload URL path is set either by the &#39;upload_url_path&#39; option or by using\n * the &#39;WP_CONTENT_URL&#39; constant and appending &#39;\/uploads&#39; to the path.\n *\n * If the &#39;uploads_use_yearmonth_folders&#39; is set to true (checkbox if checked in\n * the administration settings panel), then the time will be used. The format\n * will be year first and then month.\n *\n * If the path couldn&#39;t be created, then an error will be returned with the key\n * &#39;error&#39; containing the error message. The error suggests that the parent\n * directory is not writable by the server.\n *\n * On success, the returned array will have many indices:\n * &#39;path&#39; - base directory and sub directory or full path to upload directory.\n * &#39;url&#39; - base url and sub directory or absolute URL to upload directory.\n * &#39;subdir&#39; - sub directory if uploads use year\/month folders option is on.\n * &#39;basedir&#39; - path without subdir.\n * &#39;baseurl&#39; - URL path without subdir.\n * &#39;error&#39; - set to false.\n *\n * @since 2.0.0\n * @uses apply_filters() Calls &#39;upload_dir&#39; on returned array.\n *\n * @param string $time Optional. Time formatted in &#39;yyyy\/mm&#39;.\n * @return array See above for description.\n *\/\nfunction wp_upload_dir( $time = null ) {\n    $siteurl = get_option( &#39;siteurl&#39; );\n    $upload_path = get_option( &#39;upload_path&#39; );\n    $upload_path = trim($upload_path);\n    if ( empty($upload_path) ) {\n        $dir = WP_CONTENT_DIR . &#39;\/uploads&#39;;\n    } else {\n        $dir = $upload_path;\n        if ( &#39;wp-content\/uploads&#39; == $upload_path ) {\n            $dir = WP_CONTENT_DIR . &#39;\/uploads&#39;;\n        } elseif ( 0 !== strpos($dir, ABSPATH) ) {\n            \/\/ $dir is absolute, $upload_path is (maybe) relative to ABSPATH\n            $dir = path_join( ABSPATH, $dir );\n        }\n    }\n\n    if ( !$url = get_option( &#39;upload_url_path&#39; ) ) {\n        if ( empty($upload_path) || ( &#39;wp-content\/uploads&#39; == $upload_path ) || ( $upload_path == $dir ) )\n            $url = WP_CONTENT_URL . &#39;\/uploads&#39;;\n        else\n            $url = trailingslashit( $siteurl ) . $upload_path;\n    }\n\n    if ( defined(&#39;UPLOADS&#39;) ) {\n        $dir = ABSPATH . UPLOADS;\n        $url = trailingslashit( $siteurl ) . UPLOADS;\n    }\n\n    $bdir = $dir;\n    $burl = $url;\n\n    $subdir = &#39;&#39;;\n    if ( get_option( &#39;uploads_use_yearmonth_folders&#39; ) ) {\n        \/\/ Generate the yearly and monthly dirs\n        if ( !$time )\n            $time = current_time( &#39;mysql&#39; );\n        $y = substr( $time, 0, 4 );\n        $m = substr( $time, 5, 2 );\n        $subdir = &quot;\/$y\/$m&quot;;\n    }\n\n    $dir .= $subdir;\n    $url .= $subdir;\n\n    $uploads = apply_filters( &#39;upload_dir&#39;, array( &#39;path&#39; =&gt; $dir, &#39;url&#39; =&gt; $url, &#39;subdir&#39; =&gt; $subdir, &#39;basedir&#39; =&gt; $bdir, &#39;baseurl&#39; =&gt; $burl, &#39;error&#39; =&gt; false ) );\n\n    \/\/ Make sure we have an uploads dir\n    if ( ! wp_mkdir_p( $uploads[&#39;path&#39;] ) ) {\n        $message = sprintf( __( &#39;Unable to create directory %s. Is its parent directory writable by the server?&#39; ), $uploads[&#39;path&#39;] );\n        return array( &#39;error&#39; =&gt; $message );\n    }\n\n    return $uploads;\n}<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-15837","topic","type-topic","status-closed","hentry","topic-tag-cache","topic-tag-del","topic-tag-images","topic-tag-uploads","topic-tag-wp-o-matic"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15837\/revisions"}],"wp:attachment":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=15837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}