Ticket #31130: 31130.diff
File 31130.diff, 21.0 KB (added by , 10 years ago) |
---|
-
src/wp-admin/admin.php
84 84 auth_redirect(); 85 85 86 86 // Schedule trash collection 87 if ( ! wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') )87 if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_defined( 'WP_INSTALLING' ) ) 88 88 wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); 89 89 90 90 set_screen_options(); -
src/wp-admin/includes/class-wp-upgrader.php
2375 2375 if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) 2376 2376 return true; 2377 2377 2378 if ( defined( 'WP_INSTALLING' ) )2378 if ( wp_defined( 'WP_INSTALLING' ) ) 2379 2379 return true; 2380 2380 2381 2381 // More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters. -
src/wp-admin/includes/file.php
1056 1056 $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; 1057 1057 1058 1058 unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']); 1059 if ( ! defined( 'WP_INSTALLING' ) ) {1059 if ( ! wp_defined( 'WP_INSTALLING' ) ) { 1060 1060 update_option( 'ftp_credentials', $stored_credentials ); 1061 1061 } 1062 1062 return $credentials; -
src/wp-admin/includes/misc.php
237 237 * @param string $value 238 238 */ 239 239 function update_home_siteurl( $old_value, $value ) { 240 if ( defined( "WP_INSTALLING") )240 if ( wp_defined( 'WP_INSTALLING' ) ) 241 241 return; 242 242 243 243 // If home changed, write rewrite rules to new location. -
src/wp-admin/includes/translation-install.php
94 94 * in an error, an empty array will be returned. 95 95 */ 96 96 function wp_get_available_translations() { 97 if ( ! defined( 'WP_INSTALLING' ) && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {97 if ( ! wp_defined( 'WP_INSTALLING' ) && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) { 98 98 return $translations; 99 99 } 100 100 … … 112 112 $translations[ $translation['language'] ] = $translation; 113 113 } 114 114 115 if ( ! defined( 'WP_INSTALLING' ) ) {115 if ( ! wp_defined( 'WP_INSTALLING' ) ) { 116 116 set_site_transient( 'available_translations', $translations, 3 * HOUR_IN_SECONDS ); 117 117 } 118 118 -
src/wp-includes/default-constants.php
6 6 */ 7 7 8 8 /** 9 * Check if a constant is defined. If running unit tests, check the `$wp_config` 10 * object for the constant's corresponding property. 11 * 12 * @since 4.2.0 13 * @param string $constant Constant name to check. 14 * 15 * @return bool True if the constant is defined. False if not. 16 */ 17 function wp_defined( $constant ) { 18 global $wp_config; 19 20 // If unit tests are running, use the global `$wp_config` object instead of constants. 21 if ( defined( 'WP_RUN_CORE_TESTS' ) ) { 22 if ( isset( $wp_config->$constant ) ) { 23 return true; 24 } 25 26 return false; 27 } 28 29 if ( defined( $constant ) ) { 30 return true; 31 } 32 33 return false; 34 } 35 36 /** 37 * Define a constant. If running unit tests, set the corresponding property in 38 * the `$wp_config` object. 39 * 40 * @since 4.2.0 41 * @param string $constant Constant name to define. 42 * @param mixed $value Value to assign to the constant. 43 * 44 * @return bool True if constant was set. 45 */ 46 function wp_define( $constant, $value ) { 47 global $wp_config; 48 49 // If unit tests are running, use the global `$wp_config` object instead of constants. 50 if ( defined( 'WP_RUN_CORE_TESTS' ) ) { 51 if ( isset( $wp_config->$constant ) && $value !== $wp_config->$constant ) { 52 // temp 53 wp_die( 'unit test constant already defined with a different value' ); 54 } elseif( isset( $wp_config->$constant ) && $value === $wp_config->$constant ) { 55 return true; 56 } 57 58 $wp_config->$constant = $value; 59 60 return true; 61 } 62 63 if ( defined( $constant ) && $value !== constant( $constant ) ) { 64 // temp 65 wp_die( 'constant already defined with a different value' ); 66 } elseif ( defined( $constant ) && $value === constant( $constant ) ) { 67 return true; 68 } 69 70 define( $constant, $value ); 71 72 return true; 73 } 74 75 /** 9 76 * Defines initial WordPress constants 10 77 * 11 78 * @see wp_debug_mode() -
src/wp-includes/functions.php
1271 1271 return true; 1272 1272 1273 1273 $suppress = $wpdb->suppress_errors(); 1274 if ( ! defined( 'WP_INSTALLING' ) ) {1274 if ( ! wp_defined( 'WP_INSTALLING' ) ) { 1275 1275 $alloptions = wp_load_alloptions(); 1276 1276 } 1277 1277 // If siteurl is not set to autoload, check it specifically … … 3302 3302 } 3303 3303 3304 3304 // If installing or in the admin, provide the verbose message. 3305 if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )3305 if ( wp_defined('WP_INSTALLING') || defined('WP_ADMIN') ) 3306 3306 wp_die($wpdb->error); 3307 3307 3308 3308 // Otherwise, be terse. -
src/wp-includes/general-template.php
2819 2819 * @param string $file file relative to wp-admin/ without its ".css" extension. 2820 2820 */ 2821 2821 function wp_admin_css_uri( $file = 'wp-admin' ) { 2822 if ( defined('WP_INSTALLING') ) {2822 if ( wp_defined( 'WP_INSTALLING' ) ) { 2823 2823 $_file = "./$file.css"; 2824 2824 } else { 2825 2825 $_file = admin_url("$file.css"); -
src/wp-includes/l10n.php
49 49 // If multisite, check options. 50 50 if ( is_multisite() ) { 51 51 // Don't check blog option when installing. 52 if ( defined( 'WP_INSTALLING' ) || ( false === $ms_locale = get_option( 'WPLANG' ) ) ) {52 if ( wp_defined( 'WP_INSTALLING' ) || ( false === $ms_locale = get_option( 'WPLANG' ) ) ) { 53 53 $ms_locale = get_site_option( 'WPLANG' ); 54 54 } 55 55 … … 555 555 return $return; 556 556 } 557 557 558 if ( is_admin() || defined( 'WP_INSTALLING' ) || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {558 if ( is_admin() || wp_defined( 'WP_INSTALLING' ) || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) { 559 559 load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" ); 560 560 } 561 561 -
src/wp-includes/load.php
156 156 * @global int $upgrading the unix timestamp marking when upgrading WordPress began. 157 157 */ 158 158 function wp_maintenance() { 159 if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )159 if ( !file_exists( ABSPATH . '.maintenance' ) || wp_defined( 'WP_INSTALLING' ) ) 160 160 return; 161 161 162 162 global $upgrading; … … 466 466 */ 467 467 function wp_not_installed() { 468 468 if ( is_multisite() ) { 469 if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {469 if ( ! is_blog_installed() && ! wp_defined( 'WP_INSTALLING' ) ) { 470 470 nocache_headers(); 471 471 472 472 wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) ); 473 473 } 474 } elseif ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {474 } elseif ( ! is_blog_installed() && ! wp_defined( 'WP_INSTALLING' ) ) { 475 475 nocache_headers(); 476 476 477 477 require( ABSPATH . WPINC . '/kses.php' ); … … 537 537 array_unshift( $plugins, ABSPATH . 'my-hacks.php' ); 538 538 } 539 539 540 if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )540 if ( empty( $active_plugins ) || wp_defined( 'WP_INSTALLING' ) ) 541 541 return $plugins; 542 542 543 543 $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; -
src/wp-includes/ms-blogs.php
635 635 } 636 636 637 637 if ( did_action( 'init' ) ) { 638 /* @var WP_ROLES $wp_roles */ 638 639 $wp_roles->reinit(); 639 640 $current_user = wp_get_current_user(); 640 641 $current_user->for_blog( $new_blog ); -
src/wp-includes/ms-functions.php
1126 1126 if ( domain_exists($domain, $path, $site_id) ) 1127 1127 return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) ); 1128 1128 1129 if ( ! defined('WP_INSTALLING') )1130 define( 'WP_INSTALLING', true );1129 if ( ! wp_defined( 'WP_INSTALLING' ) ) 1130 wp_define( 'WP_INSTALLING', true ); 1131 1131 1132 1132 if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) 1133 1133 return new WP_Error('insert_blog', __('Could not create site.')); … … 2146 2146 if ( !is_main_site() ) 2147 2147 return; 2148 2148 2149 if ( ! wp_next_scheduled('update_network_counts') && !defined('WP_INSTALLING') )2149 if ( ! wp_next_scheduled( 'update_network_counts' ) && ! wp_defined( 'WP_INSTALLING' ) ) 2150 2150 wp_schedule_event(time(), 'twicedaily', 'update_network_counts'); 2151 2151 } 2152 2152 -
src/wp-includes/ms-settings.php
115 115 } 116 116 117 117 // @todo Investigate when exactly this can occur. 118 if ( empty( $current_blog ) && defined( 'WP_INSTALLING' ) ) {118 if ( empty( $current_blog ) && wp_defined( 'WP_INSTALLING' ) ) { 119 119 $current_blog = new stdClass; 120 120 $current_blog->blog_id = $blog_id = 1; 121 121 } -
src/wp-includes/option.php
49 49 if ( defined( 'WP_SETUP_CONFIG' ) ) 50 50 return false; 51 51 52 if ( ! defined( 'WP_INSTALLING' ) ) {52 if ( ! wp_defined( 'WP_INSTALLING' ) ) { 53 53 // prevent non-existent options from triggering multiple queries 54 54 $notoptions = wp_cache_get( 'notoptions', 'options' ); 55 55 if ( isset( $notoptions[ $option ] ) ) { … … 158 158 function wp_load_alloptions() { 159 159 global $wpdb; 160 160 161 if ( ! defined( 'WP_INSTALLING' ) || !is_multisite() )161 if ( ! wp_defined( 'WP_INSTALLING' ) || ! is_multisite() ) 162 162 $alloptions = wp_cache_get( 'alloptions', 'options' ); 163 163 else 164 164 $alloptions = false; … … 172 172 foreach ( (array) $alloptions_db as $o ) { 173 173 $alloptions[$o->option_name] = $o->option_value; 174 174 } 175 if ( ! defined( 'WP_INSTALLING' ) || !is_multisite() )175 if ( ! wp_defined( 'WP_INSTALLING' ) || !is_multisite() ) 176 176 wp_cache_add( 'alloptions', $alloptions, 'options' ); 177 177 } 178 178 … … 189 189 function wp_load_core_site_options( $site_id = null ) { 190 190 global $wpdb; 191 191 192 if ( ! is_multisite() || wp_using_ext_object_cache() ||defined( 'WP_INSTALLING' ) )192 if ( ! is_multisite() || wp_using_ext_object_cache() || wp_defined( 'WP_INSTALLING' ) ) 193 193 return; 194 194 195 195 if ( empty($site_id) ) … … 294 294 wp_cache_set( 'notoptions', $notoptions, 'options' ); 295 295 } 296 296 297 if ( ! defined( 'WP_INSTALLING' ) ) {297 if ( ! wp_defined( 'WP_INSTALLING' ) ) { 298 298 $alloptions = wp_load_alloptions(); 299 299 if ( isset( $alloptions[$option] ) ) { 300 300 $alloptions[ $option ] = $serialized_value; … … 390 390 if ( ! $result ) 391 391 return false; 392 392 393 if ( ! defined( 'WP_INSTALLING' ) ) {393 if ( ! wp_defined( 'WP_INSTALLING' ) ) { 394 394 if ( 'yes' == $autoload ) { 395 395 $alloptions = wp_load_alloptions(); 396 396 $alloptions[ $option ] = $serialized_value; … … 464 464 do_action( 'delete_option', $option ); 465 465 466 466 $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) ); 467 if ( ! defined( 'WP_INSTALLING' ) ) {467 if ( ! wp_defined( 'WP_INSTALLING' ) ) { 468 468 if ( 'yes' == $row->autoload ) { 469 469 $alloptions = wp_load_alloptions(); 470 470 if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) { … … 582 582 $value = wp_cache_get( $transient, 'transient' ); 583 583 } else { 584 584 $transient_option = '_transient_' . $transient; 585 if ( ! defined( 'WP_INSTALLING' ) ) {585 if ( ! wp_defined( 'WP_INSTALLING' ) ) { 586 586 // If option is not in alloptions, it is not autoloaded and thus has a timeout 587 587 $alloptions = wp_load_alloptions(); 588 588 if ( !isset( $alloptions[$transient_option] ) ) { -
src/wp-includes/script-loader.php
744 744 function wp_style_loader_src( $src, $handle ) { 745 745 global $_wp_admin_css_colors; 746 746 747 if ( defined('WP_INSTALLING') )747 if ( wp_defined('WP_INSTALLING') ) 748 748 return preg_replace( '#^wp-admin/#', './', $src ); 749 749 750 750 if ( 'colors' == $handle ) { -
src/wp-includes/theme.php
845 845 * 846 846 * @param bool true Validation flag to check the current theme. 847 847 */ 848 if ( defined('WP_INSTALLING') || ! apply_filters( 'validate_current_theme', true ) )848 if ( wp_defined('WP_INSTALLING') || ! apply_filters( 'validate_current_theme', true ) ) 849 849 return true; 850 850 851 851 if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) { -
src/wp-includes/update.php
21 21 * @return null|false Returns null if update is unsupported. Returns false if check is too soon. 22 22 */ 23 23 function wp_version_check( $extra_stats = array(), $force_check = false ) { 24 if ( defined('WP_INSTALLING') )24 if ( wp_defined( 'WP_INSTALLING' ) ) 25 25 return; 26 26 27 27 global $wpdb, $wp_local_package; … … 185 185 function wp_update_plugins( $extra_stats = array() ) { 186 186 include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version 187 187 188 if ( defined('WP_INSTALLING') )188 if ( wp_defined( 'WP_INSTALLING' ) ) 189 189 return false; 190 190 191 191 // If running blog-side, bail unless we've not checked in the last 12 hours … … 339 339 function wp_update_themes( $extra_stats = array() ) { 340 340 include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version 341 341 342 if ( defined( 'WP_INSTALLING' ) )342 if ( wp_defined( 'WP_INSTALLING' ) ) 343 343 return false; 344 344 345 345 $installed_themes = wp_get_themes(); … … 626 626 * @since 3.1.0 627 627 */ 628 628 function wp_schedule_update_checks() { 629 if ( ! wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )629 if ( ! wp_next_scheduled( 'wp_version_check' ) && ! wp_defined( 'WP_INSTALLING' ) ) 630 630 wp_schedule_event(time(), 'twicedaily', 'wp_version_check'); 631 631 632 if ( ! wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )632 if ( ! wp_next_scheduled( 'wp_update_plugins' ) && ! wp_defined( 'WP_INSTALLING' ) ) 633 633 wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); 634 634 635 if ( ! wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )635 if ( ! wp_next_scheduled( 'wp_update_themes' ) && ! wp_defined( 'WP_INSTALLING' ) ) 636 636 wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); 637 637 638 if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {638 if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! wp_defined( 'WP_INSTALLING' ) ) { 639 639 // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site. 640 640 $next = strtotime( 'today 7am' ); 641 641 $now = time(); -
src/wp-settings.php
17 17 */ 18 18 define( 'WPINC', 'wp-includes' ); 19 19 20 $wp_config = new stdClass(); 21 20 22 // Include files required for initialization. 21 23 require( ABSPATH . WPINC . '/load.php' ); 22 24 require( ABSPATH . WPINC . '/default-constants.php' ); … … 322 324 $GLOBALS['wp_locale'] = new WP_Locale(); 323 325 324 326 // Load the functions for the active theme, for both parent and child theme if applicable. 325 if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {327 if ( ! wp_defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) { 326 328 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) ) 327 329 include( STYLESHEETPATH . '/functions.php' ); 328 330 if ( file_exists( TEMPLATEPATH . '/functions.php' ) ) -
tests/phpunit/includes/testcase.php
56 56 } 57 57 58 58 function tearDown() { 59 global $wpdb, $wp_query, $post ;59 global $wpdb, $wp_query, $post, $wp_config; 60 60 $this->expectedDeprecated(); 61 61 $wpdb->query( 'ROLLBACK' ); 62 62 if ( is_multisite() ) { … … 66 66 } 67 67 $wp_query = new WP_Query(); 68 68 $post = null; 69 $wp_config = new stdClass(); 69 70 remove_theme_support( 'html5' ); 70 71 remove_filter( 'query', array( $this, '_create_temporary_tables' ) ); 71 72 remove_filter( 'query', array( $this, '_drop_temporary_tables' ) ); -
tests/phpunit/tests/multisite/network.php
170 170 $this->assertFalse(wp_next_scheduled('update_network_counts')); 171 171 172 172 // We can't use wp_schedule_update_network_counts() because WP_INSTALLING is set 173 wp_schedule_ event(time(), 'twicedaily', 'update_network_counts');173 wp_schedule_update_network_counts(); 174 174 175 175 $this->assertInternalType('int', wp_next_scheduled('update_network_counts')); 176 176 } -
tests/phpunit/tests/option/transient.php
38 38 * @ticket 22807 39 39 */ 40 40 function test_transient_data_with_timeout() { 41 if ( is_multisite() ) {42 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );43 }44 45 41 $key = rand_str(); 46 42 $value = rand_str(); 47 43 … … 63 59 * @ticket 22807 64 60 */ 65 61 function test_transient_add_timeout() { 66 if ( is_multisite() ) {67 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );68 }69 70 62 $key = rand_str(); 71 63 $value = rand_str(); 72 64 $value2 = rand_str(); -
tests/phpunit/tests/post/getPostClass.php
50 50 public function test_taxonomy_classes_hit_cache() { 51 51 global $wpdb; 52 52 53 if ( is_multisite() ) {54 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );55 }56 57 53 register_taxonomy( 'wptests_tax', 'post' ); 58 54 wp_set_post_terms( $this->post_id, array( 'foo', 'bar' ), 'wptests_tax' ); 59 55 wp_set_post_terms( $this->post_id, array( 'footag', 'bartag' ), 'post_tag' ); -
tests/phpunit/tests/term/getTerms.php
382 382 public function test_child_of_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() { 383 383 global $wpdb; 384 384 385 if ( is_multisite() ) {386 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );387 }388 389 385 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) ); 390 386 391 387 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); … … 1249 1245 public function test_parent_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() { 1250 1246 global $wpdb; 1251 1247 1252 if ( is_multisite() ) {1253 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );1254 }1255 1256 1248 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) ); 1257 1249 1258 1250 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );