Ticket #6938: allow-wp-content-directory-outside-of-webroot.patch
| File allow-wp-content-directory-outside-of-webroot.patch, 11.5 kB (added by sambauers, 7 months ago) |
|---|
-
wp-includes/js/tinymce/tiny_mce_config.php
old new 206 206 } 207 207 208 208 // Cache path, this is where the .gz files will be stored 209 $cache_path = ABSPATH . 'wp-content/uploads/js_cache';209 $cache_path = ABSPATH . WP_CONTENT_DIR . '/uploads/js_cache'; 210 210 if ( $disk_cache && ! is_dir($cache_path) ) 211 211 $disk_cache = wp_mkdir_p($cache_path); 212 212 -
wp-includes/theme.php
old new 333 333 } 334 334 335 335 function get_theme_root() { 336 return apply_filters('theme_root', ABSPATH . "wp-content/themes");336 return apply_filters('theme_root', ABSPATH . WP_CONTENT_DIR . "/themes"); 337 337 } 338 338 339 339 function get_theme_root_uri() { 340 return apply_filters('theme_root_uri', get_option('siteurl') . "/ wp-content/themes", get_option('siteurl'));340 return apply_filters('theme_root_uri', get_option('siteurl') . "/" . WP_CONTENT_DIR . "/themes", get_option('siteurl')); 341 341 } 342 342 343 343 function get_query_template($type) { -
wp-includes/functions.php
old new 1080 1080 $siteurl = get_option( 'siteurl' ); 1081 1081 $upload_path = get_option( 'upload_path' ); 1082 1082 if ( trim($upload_path) === '' ) 1083 $upload_path = 'wp-content/uploads';1083 $upload_path = WP_CONTENT_DIR . '/uploads'; 1084 1084 $dir = $upload_path; 1085 1085 1086 1086 // $dir is absolute, $path is (maybe) relative to ABSPATH … … 1558 1558 */ 1559 1559 function require_wp_db() { 1560 1560 global $wpdb; 1561 if ( file_exists( ABSPATH . 'wp-content/db.php' ) )1562 require_once( ABSPATH . 'wp-content/db.php' );1561 if ( file_exists( ABSPATH . WP_CONTENT_DIR . '/db.php' ) ) 1562 require_once( ABSPATH . WP_CONTENT_DIR . '/db.php' ); 1563 1563 else 1564 1564 require_once( ABSPATH . WPINC . '/wp-db.php' ); 1565 1565 } … … 1568 1568 global $wpdb; 1569 1569 1570 1570 // Load custom DB error template, if present. 1571 if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) {1572 require_once( ABSPATH . 'wp-content/db-error.php' );1571 if ( file_exists( ABSPATH . WP_CONTENT_DIR . '/db-error.php' ) ) { 1572 require_once( ABSPATH . WP_CONTENT_DIR . '/db-error.php' ); 1573 1573 die(); 1574 1574 } 1575 1575 -
wp-includes/comment-template.php
old new 665 665 if ( file_exists( $include ) ) 666 666 require( $include ); 667 667 else 668 require( ABSPATH . 'wp-content/themes/default/comments.php');668 require( ABSPATH . WP_CONTENT_DIR . '/themes/default/comments.php'); 669 669 } 670 670 671 671 /** -
wp-includes/general-template.php
old new 7 7 if ( file_exists( TEMPLATEPATH . '/header.php') ) 8 8 load_template( TEMPLATEPATH . '/header.php'); 9 9 else 10 load_template( ABSPATH . 'wp-content/themes/default/header.php');10 load_template( ABSPATH . WP_CONTENT_DIR . '/themes/default/header.php'); 11 11 } 12 12 13 13 … … 16 16 if ( file_exists( TEMPLATEPATH . '/footer.php') ) 17 17 load_template( TEMPLATEPATH . '/footer.php'); 18 18 else 19 load_template( ABSPATH . 'wp-content/themes/default/footer.php');19 load_template( ABSPATH . WP_CONTENT_DIR . '/themes/default/footer.php'); 20 20 } 21 21 22 22 … … 27 27 elseif ( file_exists( TEMPLATEPATH . '/sidebar.php') ) 28 28 load_template( TEMPLATEPATH . '/sidebar.php'); 29 29 else 30 load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');30 load_template( ABSPATH . WP_CONTENT_DIR . '/themes/default/sidebar.php'); 31 31 } 32 32 33 33 -
wp-includes/rss.php
old new 651 651 } 652 652 653 653 class RSSCache { 654 var $BASE_CACHE = 'wp-content/cache'; // where the cache files are stored654 var $BASE_CACHE = WP_CONTENT_DIR . '/cache'; // where the cache files are stored 655 655 var $MAX_AGE = 43200; // when are files stale, default twelve hours 656 656 var $ERROR = ''; // accumulate error messages 657 657 -
wp-settings.php
old new 100 100 die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.3.' ); 101 101 } 102 102 103 if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') ) 103 104 if ( !defined('WP_CONTENT_DIR') ) 105 define( 'WP_CONTENT_DIR', 'wp-content' ); // no leading slash, no trailing slash, relative directories are OK 106 107 if ( !extension_loaded('mysql') && !file_exists(ABSPATH . WP_CONTENT_DIR . '/db.php') ) 104 108 die( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ); 105 109 106 110 /** … … 166 170 167 171 // For an advanced caching plugin to use, static because you would only want one 168 172 if ( defined('WP_CACHE') ) 169 @include ABSPATH . 'wp-content/advanced-cache.php';173 @include ABSPATH . WP_CONTENT_DIR . '/advanced-cache.php'; 170 174 171 175 /** 172 176 * Stores the location of the WordPress directory of functions, classes, and core content. … … 182 186 * 183 187 * @since 2.1.0 184 188 */ 185 if ( file_exists( ABSPATH . 'wp-content/languages') && @is_dir(ABSPATH . 'wp-content/languages') )186 define('LANGDIR', 'wp-content/languages'); // no leading slash, no trailing slash189 if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) 190 define('LANGDIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash 187 191 else 188 192 define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash 189 193 } … … 197 201 * @since 2.1 198 202 */ 199 203 if ( !defined('PLUGINDIR') ) 200 define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash204 define('PLUGINDIR', WP_CONTENT_DIR . '/plugins'); // no leading slash, no trailing slash 201 205 202 206 require (ABSPATH . WPINC . '/compat.php'); 203 207 require (ABSPATH . WPINC . '/functions.php'); … … 213 217 if ( is_wp_error($prefix) ) 214 218 wp_die('<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'); 215 219 216 if ( file_exists(ABSPATH . 'wp-content/object-cache.php') )217 require_once (ABSPATH . 'wp-content/object-cache.php');220 if ( file_exists(ABSPATH . WP_CONTENT_DIR . '/object-cache.php') ) 221 require_once (ABSPATH . WP_CONTENT_DIR . '/object-cache.php'); 218 222 else 219 223 require_once (ABSPATH . WPINC . '/cache.php'); 220 224 -
wp-admin/includes/schema.php
old new 226 226 if ( ini_get('safe_mode') ) { 227 227 // Safe mode screws up mkdir(), so we must use a flat structure. 228 228 add_option('uploads_use_yearmonth_folders', 0); 229 add_option('upload_path', 'wp-content');229 add_option('upload_path', WP_CONTENT_DIR); 230 230 } else { 231 231 add_option('uploads_use_yearmonth_folders', 1); 232 add_option('upload_path', 'wp-content/uploads');232 add_option('upload_path', WP_CONTENT_DIR . '/uploads'); 233 233 } 234 234 235 235 // 2.0.3 -
wp-admin/includes/file.php
old new 46 46 if ( defined('WP_TEMP_DIR') ) 47 47 return trailingslashit(WP_TEMP_DIR); 48 48 49 $temp = ABSPATH . 'wp-content/';49 $temp = ABSPATH . WP_CONTENT_DIR . '/'; 50 50 if ( is_dir($temp) && is_writable($temp) ) 51 51 return $temp; 52 52 -
wp-admin/includes/update.php
old new 179 179 if ( is_wp_error($file) ) 180 180 return new WP_Error('download_failed', __('Download failed.'), $file->get_error_message()); 181 181 182 $working_dir = $base . 'wp-content/upgrade/' . basename($plugin, '.php');182 $working_dir = $base . WP_CONTENT_DIR . '/upgrade/' . basename($plugin, '.php'); 183 183 184 184 // Clean up working directory 185 185 if ( $wp_filesystem->is_dir($working_dir) ) -
wp-admin/includes/upgrade.php
old new 1 1 <?php 2 2 3 if ( file_exists(ABSPATH . 'wp-content/install.php') )4 require (ABSPATH . 'wp-content/install.php');3 if ( file_exists(ABSPATH . WP_CONTENT_DIR . '/install.php') ) 4 require (ABSPATH . WP_CONTENT_DIR . '/install.php'); 5 5 require_once(ABSPATH . 'wp-admin/includes/admin.php'); 6 6 require_once(ABSPATH . 'wp-admin/includes/schema.php'); 7 7 … … 1077 1077 1078 1078 function make_site_theme_from_oldschool($theme_name, $template) { 1079 1079 $home_path = get_home_path(); 1080 $site_dir = ABSPATH . "wp-content/themes/$template";1080 $site_dir = ABSPATH . WP_CONTENT_DIR . "/themes/$template"; 1081 1081 1082 1082 if (! file_exists("$home_path/index.php")) 1083 1083 return false; … … 1096 1096 if ($oldfile == 'index.php') { // Check to make sure it's not a new index 1097 1097 $index = implode('', file("$oldpath/$oldfile")); 1098 1098 if (strpos($index, 'WP_USE_THEMES') !== false) { 1099 if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))1099 if (! @copy(ABSPATH . WP_CONTENT_DIR . '/themes/default/index.php', "$site_dir/$newfile")) 1100 1100 return false; 1101 1101 continue; // Don't copy anything 1102 1102 } … … 1144 1144 } 1145 1145 1146 1146 function make_site_theme_from_default($theme_name, $template) { 1147 $site_dir = ABSPATH . "wp-content/themes/$template";1148 $default_dir = ABSPATH . 'wp-content/themes/default';1147 $site_dir = ABSPATH . WP_CONTENT_DIR . "/themes/$template"; 1148 $default_dir = ABSPATH . WP_CONTENT_DIR . '/themes/default'; 1149 1149 1150 1150 // Copy files from the default theme to the site theme. 1151 1151 //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css'); … … 1202 1202 // Name the theme after the blog. 1203 1203 $theme_name = __get_option('blogname'); 1204 1204 $template = sanitize_title($theme_name); 1205 $site_dir = ABSPATH . "wp-content/themes/$template";1205 $site_dir = ABSPATH . WP_CONTENT_DIR . "/themes/$template"; 1206 1206 1207 1207 // If the theme already exists, nothing to do. 1208 1208 if ( is_dir($site_dir)) { … … 1210 1210 } 1211 1211 1212 1212 // We must be able to write to the themes dir. 1213 if (! is_writable(ABSPATH . "wp-content/themes")) {1213 if (! is_writable(ABSPATH . WP_CONTENT_DIR . "/themes")) { 1214 1214 return false; 1215 1215 } 1216 1216 -
wp-admin/import/mt.php
old new 179 179 180 180 function select_authors() { 181 181 if ( $_POST['upload_type'] === 'ftp' ) { 182 $file['file'] = ABSPATH . 'wp-content/mt-export.txt';182 $file['file'] = ABSPATH . WP_CONTENT_DIR . '/mt-export.txt'; 183 183 if ( !file_exists($file['file']) ) 184 184 $file['error'] = __('<code>mt-export.txt</code> does not exist'); 185 185 } else { … … 426 426 function import() { 427 427 $this->id = (int) $_GET['id']; 428 428 if ( $this->id == 0 ) 429 $this->file = ABSPATH . 'wp-content/mt-export.txt';429 $this->file = ABSPATH . WP_CONTENT_DIR . '/mt-export.txt'; 430 430 else 431 431 $this->file = get_attached_file($this->id); 432 432 $this->get_authors_from_post();
