-
diff --git src/wp-admin/admin.php src/wp-admin/admin.php
index d3e58d2..8903efa 100644
|
|
require_once(ABSPATH . 'wp-admin/includes/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_installing() ) |
88 | 88 | wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); |
89 | 89 | |
90 | 90 | set_screen_options(); |
-
diff --git src/wp-admin/includes/class-wp-upgrader.php src/wp-admin/includes/class-wp-upgrader.php
index 65cbab4..52210eb 100644
|
|
class WP_Automatic_Updater { |
2593 | 2593 | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) |
2594 | 2594 | return true; |
2595 | 2595 | |
2596 | | if ( defined( 'WP_INSTALLING' ) ) |
| 2596 | if ( wp_installing() ) |
2597 | 2597 | return true; |
2598 | 2598 | |
2599 | 2599 | // More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters. |
… |
… |
class WP_Automatic_Updater { |
3368 | 3368 | |
3369 | 3369 | // Plugins, Themes, Translations |
3370 | 3370 | foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) { |
3371 | | |
| 3371 | |
3372 | 3372 | /** |
3373 | 3373 | * Filter to control whether a notification email is sent to the site admin email address for |
3374 | 3374 | * plugin, theme, and translation updates. |
-
diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
index a11bc95..6fa4780 100644
|
|
function request_filesystem_credentials($form_post, $type = '', $error = false, |
1081 | 1081 | $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; |
1082 | 1082 | |
1083 | 1083 | unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']); |
1084 | | if ( ! defined( 'WP_INSTALLING' ) ) { |
| 1084 | if ( ! wp_installing() ) { |
1085 | 1085 | update_option( 'ftp_credentials', $stored_credentials ); |
1086 | 1086 | } |
1087 | 1087 | return $credentials; |
-
diff --git src/wp-admin/includes/misc.php src/wp-admin/includes/misc.php
index 0e104e0..3d71855 100644
|
|
function update_recently_edited( $file ) { |
243 | 243 | * @param string $value |
244 | 244 | */ |
245 | 245 | function update_home_siteurl( $old_value, $value ) { |
246 | | if ( defined( "WP_INSTALLING" ) ) |
| 246 | if ( wp_installing() ) |
247 | 247 | return; |
248 | 248 | |
249 | 249 | if ( is_multisite() && ms_is_switched() ) { |
-
diff --git src/wp-admin/includes/translation-install.php src/wp-admin/includes/translation-install.php
index 8e1b827..2056838 100644
|
|
function translations_api( $type, $args = null ) { |
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_installing() && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) { |
98 | 98 | return $translations; |
99 | 99 | } |
100 | 100 | |
-
diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index b658337..c0b6c86 100644
|
|
function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urle |
680 | 680 | * add_query_arg( 'key', 'value', 'http://example.com' ); |
681 | 681 | * |
682 | 682 | * Using an associative array: |
683 | | * |
| 683 | * |
684 | 684 | * add_query_arg( array( |
685 | 685 | * 'key1' => 'value1', |
686 | 686 | * 'key2' => 'value2', |
687 | 687 | * ), 'http://example.com' ); |
688 | | * |
| 688 | * |
689 | 689 | * Omitting the URL from either use results in the current URL being used |
690 | 690 | * (the value of `$_SERVER['REQUEST_URI']`). |
691 | | * |
| 691 | * |
692 | 692 | * Values are expected to be encoded appropriately with urlencode() or rawurlencode(). |
693 | 693 | * |
694 | 694 | * Setting any query variable's value to boolean false removes the key (see remove_query_arg()). |
… |
… |
function do_robots() { |
1260 | 1260 | } |
1261 | 1261 | |
1262 | 1262 | /** |
| 1263 | * Check or set whether WordPress is in "installation" mode. |
| 1264 | * |
| 1265 | * If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`. |
| 1266 | * |
| 1267 | * @since 4.4.0 |
| 1268 | * |
| 1269 | * @staticvar bool $installing |
| 1270 | * |
| 1271 | * @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off. |
| 1272 | * Omit this parameter to fetch the current value. |
| 1273 | * @return bool True if WP is installing, otherwise false. |
| 1274 | */ |
| 1275 | function wp_installing( $is_installing = null ) { |
| 1276 | static $installing = null; |
| 1277 | |
| 1278 | // Support for the `WP_INSTALLING` constant, defined before WP is loaded. |
| 1279 | if ( is_null( $installing ) ) { |
| 1280 | $installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING; |
| 1281 | } |
| 1282 | |
| 1283 | if ( ! is_null( $is_installing ) ) { |
| 1284 | $old_installing = $installing; |
| 1285 | $installing = $is_installing; |
| 1286 | return (bool) $old_installing; |
| 1287 | } |
| 1288 | |
| 1289 | return (bool) $installing; |
| 1290 | } |
| 1291 | |
| 1292 | /** |
1263 | 1293 | * Test whether blog is already installed. |
1264 | 1294 | * |
1265 | 1295 | * The cache will be checked first. If you have a cache plugin, which saves |
… |
… |
function is_blog_installed() { |
1285 | 1315 | return true; |
1286 | 1316 | |
1287 | 1317 | $suppress = $wpdb->suppress_errors(); |
1288 | | if ( ! defined( 'WP_INSTALLING' ) ) { |
| 1318 | if ( ! wp_installing() ) { |
1289 | 1319 | $alloptions = wp_load_alloptions(); |
1290 | 1320 | } |
1291 | 1321 | // If siteurl is not set to autoload, check it specifically |
… |
… |
function dead_db() { |
3335 | 3365 | } |
3336 | 3366 | |
3337 | 3367 | // If installing or in the admin, provide the verbose message. |
3338 | | if ( defined('WP_INSTALLING') || defined('WP_ADMIN') ) |
| 3368 | if ( wp_installing() || defined('WP_ADMIN') ) |
3339 | 3369 | wp_die($wpdb->error); |
3340 | 3370 | |
3341 | 3371 | // Otherwise, be terse. |
-
diff --git src/wp-includes/l10n.php src/wp-includes/l10n.php
index d9b0594..b080c9e 100644
|
|
function get_locale() { |
53 | 53 | // If multisite, check options. |
54 | 54 | if ( is_multisite() ) { |
55 | 55 | // Don't check blog option when installing. |
56 | | if ( defined( 'WP_INSTALLING' ) || ( false === $ms_locale = get_option( 'WPLANG' ) ) ) { |
| 56 | if ( wp_installing() || ( false === $ms_locale = get_option( 'WPLANG' ) ) ) { |
57 | 57 | $ms_locale = get_site_option( 'WPLANG' ); |
58 | 58 | } |
59 | 59 | |
… |
… |
function load_default_textdomain( $locale = null ) { |
565 | 565 | return $return; |
566 | 566 | } |
567 | 567 | |
568 | | if ( is_admin() || defined( 'WP_INSTALLING' ) || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) { |
| 568 | if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) { |
569 | 569 | load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" ); |
570 | 570 | } |
571 | 571 | |
-
diff --git src/wp-includes/load.php src/wp-includes/load.php
index 560511a..8ca2f2c 100644
|
|
function wp_favicon_request() { |
165 | 165 | * @global int $upgrading the unix timestamp marking when upgrading WordPress began. |
166 | 166 | */ |
167 | 167 | function wp_maintenance() { |
168 | | if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) ) |
| 168 | if ( !file_exists( ABSPATH . '.maintenance' ) || wp_installing() ) |
169 | 169 | return; |
170 | 170 | |
171 | 171 | global $upgrading; |
… |
… |
function wp_start_object_cache() { |
475 | 475 | */ |
476 | 476 | function wp_not_installed() { |
477 | 477 | if ( is_multisite() ) { |
478 | | if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) { |
| 478 | if ( ! is_blog_installed() && ! wp_installing() ) { |
479 | 479 | nocache_headers(); |
480 | 480 | |
481 | 481 | wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) ); |
482 | 482 | } |
483 | | } elseif ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) { |
| 483 | } elseif ( ! is_blog_installed() && ! wp_installing() ) { |
484 | 484 | nocache_headers(); |
485 | 485 | |
486 | 486 | require( ABSPATH . WPINC . '/kses.php' ); |
… |
… |
function wp_get_mu_plugins() { |
539 | 539 | function wp_get_active_and_valid_plugins() { |
540 | 540 | $plugins = array(); |
541 | 541 | $active_plugins = (array) get_option( 'active_plugins', array() ); |
542 | | if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) ) |
| 542 | if ( empty( $active_plugins ) || wp_installing() ) |
543 | 543 | return $plugins; |
544 | 544 | |
545 | 545 | $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; |
-
diff --git src/wp-includes/ms-functions.php src/wp-includes/ms-functions.php
index d6a9861..2a08a19 100644
|
|
function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $s |
1174 | 1174 | if ( domain_exists($domain, $path, $site_id) ) |
1175 | 1175 | return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) ); |
1176 | 1176 | |
1177 | | if ( !defined('WP_INSTALLING') ) |
1178 | | define( 'WP_INSTALLING', true ); |
| 1177 | if ( ! wp_installing() ) { |
| 1178 | wp_installing( true ); |
| 1179 | } |
1179 | 1180 | |
1180 | 1181 | if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) |
1181 | 1182 | return new WP_Error('insert_blog', __('Could not create site.')); |
… |
… |
function wp_schedule_update_network_counts() { |
2228 | 2229 | if ( !is_main_site() ) |
2229 | 2230 | return; |
2230 | 2231 | |
2231 | | if ( !wp_next_scheduled('update_network_counts') && !defined('WP_INSTALLING') ) |
| 2232 | if ( !wp_next_scheduled('update_network_counts') && ! wp_installing() ) |
2232 | 2233 | wp_schedule_event(time(), 'twicedaily', 'update_network_counts'); |
2233 | 2234 | } |
2234 | 2235 | |
-
diff --git src/wp-includes/ms-settings.php src/wp-includes/ms-settings.php
index 00da6da..8bb5c2f 100644
|
|
if ( !isset( $current_site ) || !isset( $current_blog ) ) { |
136 | 136 | } |
137 | 137 | |
138 | 138 | // @todo Investigate when exactly this can occur. |
139 | | if ( empty( $current_blog ) && defined( 'WP_INSTALLING' ) ) { |
| 139 | if ( empty( $current_blog ) && wp_installing() ) { |
140 | 140 | $current_blog = new stdClass; |
141 | 141 | $current_blog->blog_id = $blog_id = 1; |
142 | 142 | } |
-
diff --git src/wp-includes/option.php src/wp-includes/option.php
index ab8f81b..6de667e 100644
|
|
function get_option( $option, $default = false ) { |
53 | 53 | if ( defined( 'WP_SETUP_CONFIG' ) ) |
54 | 54 | return false; |
55 | 55 | |
56 | | if ( ! defined( 'WP_INSTALLING' ) ) { |
| 56 | if ( ! wp_installing() ) { |
57 | 57 | // prevent non-existent options from triggering multiple queries |
58 | 58 | $notoptions = wp_cache_get( 'notoptions', 'options' ); |
59 | 59 | if ( isset( $notoptions[ $option ] ) ) { |
… |
… |
function form_option( $option ) { |
171 | 171 | function wp_load_alloptions() { |
172 | 172 | global $wpdb; |
173 | 173 | |
174 | | if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) |
| 174 | if ( ! wp_installing() || ! is_multisite() ) |
175 | 175 | $alloptions = wp_cache_get( 'alloptions', 'options' ); |
176 | 176 | else |
177 | 177 | $alloptions = false; |
… |
… |
function wp_load_alloptions() { |
185 | 185 | foreach ( (array) $alloptions_db as $o ) { |
186 | 186 | $alloptions[$o->option_name] = $o->option_value; |
187 | 187 | } |
188 | | if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) |
| 188 | if ( ! wp_installing() || ! is_multisite() ) |
189 | 189 | wp_cache_add( 'alloptions', $alloptions, 'options' ); |
190 | 190 | } |
191 | 191 | |
… |
… |
function wp_load_alloptions() { |
204 | 204 | function wp_load_core_site_options( $site_id = null ) { |
205 | 205 | global $wpdb; |
206 | 206 | |
207 | | if ( !is_multisite() || wp_using_ext_object_cache() || defined( 'WP_INSTALLING' ) ) |
| 207 | if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) |
208 | 208 | return; |
209 | 209 | |
210 | 210 | if ( empty($site_id) ) |
… |
… |
function update_option( $option, $value, $autoload = null ) { |
332 | 332 | wp_cache_set( 'notoptions', $notoptions, 'options' ); |
333 | 333 | } |
334 | 334 | |
335 | | if ( ! defined( 'WP_INSTALLING' ) ) { |
| 335 | if ( ! wp_installing() ) { |
336 | 336 | $alloptions = wp_load_alloptions(); |
337 | 337 | if ( isset( $alloptions[$option] ) ) { |
338 | 338 | $alloptions[ $option ] = $serialized_value; |
… |
… |
function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) |
433 | 433 | if ( ! $result ) |
434 | 434 | return false; |
435 | 435 | |
436 | | if ( ! defined( 'WP_INSTALLING' ) ) { |
| 436 | if ( ! wp_installing() ) { |
437 | 437 | if ( 'yes' == $autoload ) { |
438 | 438 | $alloptions = wp_load_alloptions(); |
439 | 439 | $alloptions[ $option ] = $serialized_value; |
… |
… |
function delete_option( $option ) { |
509 | 509 | do_action( 'delete_option', $option ); |
510 | 510 | |
511 | 511 | $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) ); |
512 | | if ( ! defined( 'WP_INSTALLING' ) ) { |
| 512 | if ( ! wp_installing() ) { |
513 | 513 | if ( 'yes' == $row->autoload ) { |
514 | 514 | $alloptions = wp_load_alloptions(); |
515 | 515 | if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) { |
… |
… |
function get_transient( $transient ) { |
629 | 629 | $value = wp_cache_get( $transient, 'transient' ); |
630 | 630 | } else { |
631 | 631 | $transient_option = '_transient_' . $transient; |
632 | | if ( ! defined( 'WP_INSTALLING' ) ) { |
| 632 | if ( ! wp_installing() ) { |
633 | 633 | // If option is not in alloptions, it is not autoloaded and thus has a timeout |
634 | 634 | $alloptions = wp_load_alloptions(); |
635 | 635 | if ( !isset( $alloptions[$transient_option] ) ) { |
-
diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
index f5648a7..6f59c57 100644
|
|
function wp_just_in_time_script_localization() { |
829 | 829 | function wp_style_loader_src( $src, $handle ) { |
830 | 830 | global $_wp_admin_css_colors; |
831 | 831 | |
832 | | if ( defined('WP_INSTALLING') ) |
| 832 | if ( wp_installing() ) |
833 | 833 | return preg_replace( '#^wp-admin/#', './', $src ); |
834 | 834 | |
835 | 835 | if ( 'colors' == $handle ) { |
-
diff --git src/wp-includes/theme.php src/wp-includes/theme.php
index 906da51..e1a0334 100644
|
|
function validate_current_theme() { |
771 | 771 | * |
772 | 772 | * @param bool true Validation flag to check the current theme. |
773 | 773 | */ |
774 | | if ( defined('WP_INSTALLING') || ! apply_filters( 'validate_current_theme', true ) ) |
| 774 | if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) ) |
775 | 775 | return true; |
776 | 776 | |
777 | 777 | if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) { |
-
diff --git src/wp-includes/update.php src/wp-includes/update.php
index c39322e..9814ea4 100644
|
|
|
22 | 22 | * @param bool $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set. |
23 | 23 | */ |
24 | 24 | function wp_version_check( $extra_stats = array(), $force_check = false ) { |
25 | | if ( defined( 'WP_INSTALLING' ) ) { |
| 25 | if ( wp_installing() ) { |
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
… |
… |
function wp_version_check( $extra_stats = array(), $force_check = false ) { |
187 | 187 | * @param array $extra_stats Extra statistics to report to the WordPress.org API. |
188 | 188 | */ |
189 | 189 | function wp_update_plugins( $extra_stats = array() ) { |
190 | | if ( defined( 'WP_INSTALLING' ) ) { |
| 190 | if ( wp_installing() ) { |
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
… |
… |
function wp_update_plugins( $extra_stats = array() ) { |
344 | 344 | * @param array $extra_stats Extra statistics to report to the WordPress.org API. |
345 | 345 | */ |
346 | 346 | function wp_update_themes( $extra_stats = array() ) { |
347 | | if ( defined( 'WP_INSTALLING' ) ) { |
| 347 | if ( wp_installing() ) { |
348 | 348 | return; |
349 | 349 | } |
350 | 350 | global $wp_version; |
… |
… |
function _maybe_update_themes() { |
636 | 636 | * @since 3.1.0 |
637 | 637 | */ |
638 | 638 | function wp_schedule_update_checks() { |
639 | | if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') ) |
| 639 | if ( ! wp_next_scheduled('wp_version_check') && ! wp_installing() ) |
640 | 640 | wp_schedule_event(time(), 'twicedaily', 'wp_version_check'); |
641 | 641 | |
642 | | if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') ) |
| 642 | if ( ! wp_next_scheduled('wp_update_plugins') && ! wp_installing() ) |
643 | 643 | wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); |
644 | 644 | |
645 | | if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') ) |
| 645 | if ( ! wp_next_scheduled('wp_update_themes') && ! wp_installing() ) |
646 | 646 | wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); |
647 | 647 | |
648 | | if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) { |
| 648 | if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! wp_installing() ) { |
649 | 649 | // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site. |
650 | 650 | $next = strtotime( 'today 7am' ); |
651 | 651 | $now = time(); |
-
diff --git src/wp-settings.php src/wp-settings.php
index 993a120..9a3afd8 100644
|
|
require_once( ABSPATH . WPINC . '/locale.php' ); |
321 | 321 | $GLOBALS['wp_locale'] = new WP_Locale(); |
322 | 322 | |
323 | 323 | // Load the functions for the active theme, for both parent and child theme if applicable. |
324 | | if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) { |
| 324 | if ( ! wp_installing() || 'wp-activate.php' === $pagenow ) { |
325 | 325 | if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) ) |
326 | 326 | include( STYLESHEETPATH . '/functions.php' ); |
327 | 327 | if ( file_exists( TEMPLATEPATH . '/functions.php' ) ) |
-
diff --git tests/phpunit/includes/factory.php tests/phpunit/includes/factory.php
index 20bad89..bc8ea09 100644
|
|
class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing { |
173 | 173 | $suppress = $wpdb->suppress_errors(); |
174 | 174 | $blog = wpmu_create_blog( $args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id'] ); |
175 | 175 | $wpdb->suppress_errors( $suppress ); |
| 176 | |
| 177 | // Tell WP we're done installing. |
| 178 | wp_installing( false ); |
| 179 | |
176 | 180 | return $blog; |
177 | 181 | } |
178 | 182 | |
-
diff --git tests/phpunit/includes/testcase.php tests/phpunit/includes/testcase.php
index e660e95..f5a7db8 100644
|
|
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { |
14 | 14 | protected static $hooks_saved = array(); |
15 | 15 | protected static $ignore_files; |
16 | 16 | |
17 | | protected $db_version; |
18 | | |
19 | 17 | /** |
20 | 18 | * @var WP_UnitTest_Factory |
21 | 19 | */ |
… |
… |
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { |
57 | 55 | add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) ); |
58 | 56 | |
59 | 57 | add_filter( 'wp_mail', array( $this, 'set_wp_mail_globals' ) ); |
60 | | |
61 | | /* |
62 | | * During multisite tests, WP_INSTALLING forces `get_option()` to miss the cache, which causes problems |
63 | | * with our query-counting cache tests. As a workaround in the case of tests that require checking |
64 | | * 'db_version' (such as any test that uses the Term Meta API), we filter 'pre_option_db_version' and |
65 | | * avoid hitting the database. |
66 | | * |
67 | | * See #31130. |
68 | | */ |
69 | | $this->db_version = get_option( 'db_version' ); |
70 | | if ( is_multisite() ) { |
71 | | add_filter( 'pre_option_db_version', array( $this, 'db_version' ) ); |
72 | | } |
73 | 58 | } |
74 | 59 | |
75 | 60 | /** |
… |
… |
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { |
632 | 617 | return wp_delete_user( $user_id ); |
633 | 618 | } |
634 | 619 | } |
635 | | |
636 | | /** |
637 | | * Return the current database version without hitting the database. |
638 | | * |
639 | | * This is used to bypass cache problems with some multisite tests. See #31130. |
640 | | * |
641 | | * @todo Don't do this anymore once #31130 is fixed. |
642 | | * |
643 | | * @since 4.4.0 |
644 | | */ |
645 | | public function db_version() { |
646 | | return $this->db_version; |
647 | | } |
648 | 620 | } |
-
diff --git tests/phpunit/tests/comment/getPageOfComment.php tests/phpunit/tests/comment/getPageOfComment.php
index 78e53d5..1e57023 100644
|
|
class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { |
60 | 60 | * @ticket 11334 |
61 | 61 | */ |
62 | 62 | public function test_subsequent_calls_should_hit_cache() { |
63 | | // `get_page_of_comment()` calls `get_option()`, which is not properly cached when WP_INSTALLING. |
64 | | if ( is_multisite() ) { |
65 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
66 | | } |
67 | | |
68 | 63 | global $wpdb; |
69 | 64 | |
70 | 65 | $p = $this->factory->post->create(); |
-
diff --git tests/phpunit/tests/general/archives.php tests/phpunit/tests/general/archives.php
index 23d1131..b70b5e3 100644
|
|
class Tests_General_Archives extends WP_UnitTestCase { |
16 | 16 | function test_get_archives_cache() { |
17 | 17 | global $wpdb; |
18 | 18 | |
19 | | if ( is_multisite() ) { |
20 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
21 | | } |
22 | | |
23 | 19 | $this->factory->post->create_many( 15, array( 'post_type' => 'post' ) ); |
24 | 20 | wp_cache_delete( 'last_changed', 'posts' ); |
25 | 21 | $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) ); |
… |
… |
class Tests_General_Archives extends WP_UnitTestCase { |
112 | 108 | $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); |
113 | 109 | $this->assertEquals( $num_queries, $wpdb->num_queries ); |
114 | 110 | } |
115 | | } |
116 | | No newline at end of file |
| 111 | } |
-
diff --git tests/phpunit/tests/option/transient.php tests/phpunit/tests/option/transient.php
index 3dbd79d..ada1f84 100644
|
|
class Tests_Option_Transient extends WP_UnitTestCase { |
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 | if ( wp_using_ext_object_cache() ) { |
46 | 42 | $this->markTestSkipped( 'Not testable with an external object cache.' ); |
47 | 43 | } |
… |
… |
class Tests_Option_Transient extends WP_UnitTestCase { |
67 | 63 | * @ticket 22807 |
68 | 64 | */ |
69 | 65 | function test_transient_add_timeout() { |
70 | | if ( is_multisite() ) { |
71 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' ); |
72 | | } |
73 | | |
74 | 66 | if ( wp_using_ext_object_cache() ) { |
75 | 67 | $this->markTestSkipped( 'Not testable with an external object cache.' ); |
76 | 68 | } |
… |
… |
class Tests_Option_Transient extends WP_UnitTestCase { |
130 | 122 | * @ticket 30380 |
131 | 123 | */ |
132 | 124 | function test_nonexistent_key_old_timeout() { |
133 | | if ( is_multisite() ) { |
134 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' ); |
135 | | } |
136 | | |
137 | 125 | if ( wp_using_ext_object_cache() ) { |
138 | 126 | $this->markTestSkipped( 'Not testable with an external object cache.' ); |
139 | 127 | } |
-
diff --git tests/phpunit/tests/option/updateOption.php tests/phpunit/tests/option/updateOption.php
index 4171a73..cddc46c 100644
|
|
class Tests_Option_UpdateOption extends WP_UnitTestCase { |
20 | 20 | * @ticket 26394 |
21 | 21 | */ |
22 | 22 | public function test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_missing() { |
23 | | if ( is_multisite() ) { |
24 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
25 | | } |
26 | | |
27 | 23 | global $wpdb; |
28 | 24 | wp_cache_flush(); |
29 | 25 | update_option( 'test_update_option_default', 'value' ); |
… |
… |
class Tests_Option_UpdateOption extends WP_UnitTestCase { |
44 | 40 | * @ticket 26394 |
45 | 41 | */ |
46 | 42 | public function test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_yes() { |
47 | | if ( is_multisite() ) { |
48 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
49 | | } |
50 | | |
51 | 43 | global $wpdb; |
52 | 44 | wp_cache_flush(); |
53 | 45 | update_option( 'test_update_option_default', 'value', 'yes' ); |
… |
… |
class Tests_Option_UpdateOption extends WP_UnitTestCase { |
68 | 60 | * @ticket 26394 |
69 | 61 | */ |
70 | 62 | public function test_should_set_autoload_no_for_nonexistent_option_when_autoload_param_is_no() { |
71 | | if ( is_multisite() ) { |
72 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
73 | | } |
74 | | |
75 | 63 | global $wpdb; |
76 | 64 | wp_cache_flush(); |
77 | 65 | update_option( 'test_update_option_default', 'value', 'no' ); |
… |
… |
class Tests_Option_UpdateOption extends WP_UnitTestCase { |
93 | 81 | * @ticket 26394 |
94 | 82 | */ |
95 | 83 | public function test_should_set_autoload_no_for_nonexistent_option_when_autoload_param_is_false() { |
96 | | if ( is_multisite() ) { |
97 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
98 | | } |
99 | | |
100 | 84 | global $wpdb; |
101 | 85 | wp_cache_flush(); |
102 | 86 | update_option( 'test_update_option_default', 'value', false ); |
… |
… |
class Tests_Option_UpdateOption extends WP_UnitTestCase { |
118 | 102 | * @group 26394 |
119 | 103 | */ |
120 | 104 | public function test_autoload_should_be_updated_for_existing_option_when_value_is_changed() { |
121 | | if ( is_multisite() ) { |
122 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
123 | | } |
124 | | |
125 | 105 | global $wpdb; |
126 | 106 | add_option( 'foo', 'bar', '', 'no' ); |
127 | 107 | $updated = update_option( 'foo', 'bar2', true ); |
… |
… |
class Tests_Option_UpdateOption extends WP_UnitTestCase { |
143 | 123 | * @group 26394 |
144 | 124 | */ |
145 | 125 | public function test_autoload_should_not_be_updated_for_existing_option_when_value_is_unchanged() { |
146 | | if ( is_multisite() ) { |
147 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
148 | | } |
149 | | |
150 | 126 | global $wpdb; |
151 | 127 | add_option( 'foo', 'bar', '', 'yes' ); |
152 | 128 | $updated = update_option( 'foo', 'bar', false ); |
… |
… |
class Tests_Option_UpdateOption extends WP_UnitTestCase { |
169 | 145 | * @group 26394 |
170 | 146 | */ |
171 | 147 | public function test_autoload_should_not_be_updated_for_existing_option_when_value_is_changed_but_no_value_of_autoload_is_provided() { |
172 | | if ( is_multisite() ) { |
173 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
174 | | } |
175 | | |
176 | 148 | global $wpdb; |
177 | 149 | add_option( 'foo', 'bar', '', 'yes' ); |
178 | 150 | |
-
diff --git tests/phpunit/tests/post/getPostClass.php tests/phpunit/tests/post/getPostClass.php
index 5e64e33..8d29c40 100644
|
|
class Tests_Post_GetPostClass extends WP_UnitTestCase { |
108 | 108 | public function test_taxonomy_classes_hit_cache() { |
109 | 109 | global $wpdb; |
110 | 110 | |
111 | | if ( is_multisite() ) { |
112 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
113 | | } |
114 | | |
115 | 111 | register_taxonomy( 'wptests_tax', 'post' ); |
116 | 112 | wp_set_post_terms( $this->post_id, array( 'foo', 'bar' ), 'wptests_tax' ); |
117 | 113 | wp_set_post_terms( $this->post_id, array( 'footag', 'bartag' ), 'post_tag' ); |
-
diff --git tests/phpunit/tests/term/getTerms.php tests/phpunit/tests/term/getTerms.php
index f1db1aa..5256b82 100644
|
|
class Tests_Term_getTerms extends WP_UnitTestCase { |
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' ) ); |
… |
… |
class Tests_Term_getTerms extends WP_UnitTestCase { |
1327 | 1323 | public function test_parent_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() { |
1328 | 1324 | global $wpdb; |
1329 | 1325 | |
1330 | | if ( is_multisite() ) { |
1331 | | $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' ); |
1332 | | } |
1333 | | |
1334 | 1326 | register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) ); |
1335 | 1327 | |
1336 | 1328 | $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); |
-
diff --git tests/phpunit/tests/term/wpInsertTerm.php tests/phpunit/tests/term/wpInsertTerm.php
index 09b0ea2..a7984c3 100644
|
|
class Tests_Term_WpInsertTerm extends WP_UnitTestCase { |
468 | 468 | * @ticket 5809 |
469 | 469 | */ |
470 | 470 | public function test_wp_insert_term_duplicate_slug_different_taxonomy_before_410_schema_change() { |
471 | | |
472 | | // See #31130. |
473 | 471 | $old_db_version = 30055; |
474 | | if ( is_multisite() ) { |
475 | | $_db_version = $this->db_version; |
476 | | $this->db_version = $old_db_version; |
477 | | } else { |
478 | | update_option( 'db_version', $old_db_version ); |
479 | | } |
| 472 | update_option( 'db_version', $old_db_version ); |
480 | 473 | |
481 | 474 | register_taxonomy( 'wptests_tax', 'post' ); |
482 | 475 | register_taxonomy( 'wptests_tax_2', 'post' ); |
… |
… |
class Tests_Term_WpInsertTerm extends WP_UnitTestCase { |
503 | 496 | $this->assertSame( 'foo-2', $new_term->slug ); |
504 | 497 | $this->assertNotEquals( $new_term->term_id, $term->term_id ); |
505 | 498 | |
506 | | if ( is_multisite() ) { |
507 | | $this->db_version = $_db_version; |
508 | | } |
509 | | |
510 | 499 | _unregister_taxonomy( 'wptests_tax', 'post' ); |
511 | 500 | } |
512 | 501 | |