Skip to content

Commit

Permalink
Merge pull request #334 from WordPress/fix/330-rewrites
Browse files Browse the repository at this point in the history
Prevent rewrite flushes for runtime checks
  • Loading branch information
swissspidy authored Dec 11, 2023
2 parents 35eee0b + 2b5eb04 commit 0101c91
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions includes/Checker/Runtime_Environment_Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,27 @@ public function set_up() {
// Get the existing active plugins.
$active_plugins = get_option( 'active_plugins' );

// Get the existing permalink structure.
$permalink_structure = get_option( 'permalink_structure' );

// Set the new prefix.
$old_prefix = $wpdb->set_prefix( $table_prefix . 'pc_' );

// Create and populate the test database tables if they do not exist.
if ( $wpdb->posts !== $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->posts ) ) ) {
/*
* Set the same permalink structure *before* install finishes,
* so that wp_install_maybe_enable_pretty_permalinks() does not flush rewrite rules.
*
* See https://github.com/WordPress/plugin-check/issues/330
*/
add_action(
'populate_options',
static function () use ( $permalink_structure ) {
add_option( 'permalink_structure', $permalink_structure );
}
);

wp_install(
'Plugin Check',
'plugincheck',
Expand Down

0 comments on commit 0101c91

Please sign in to comment.