Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to base_prefix variable #860

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions includes/Checker/Runtime_Environment_Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ final class Runtime_Environment_Setup {
* @since 1.0.0
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global string $table_prefix The database table prefix.
* @global string $base_prefix The database table prefix.
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
*/
public function set_up() {
global $wpdb, $table_prefix, $wp_filesystem;
global $wpdb, $base_prefix, $wp_filesystem;

require_once ABSPATH . '/wp-admin/includes/upgrade.php';

Expand All @@ -41,7 +41,7 @@ public function set_up() {
$permalink_structure = get_option( 'permalink_structure' );

// Set the new prefix.
$old_prefix = $wpdb->set_prefix( $table_prefix . 'pc_' );
$old_prefix = $wpdb->set_prefix( $base_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 ) ) ) {
Expand Down Expand Up @@ -98,15 +98,15 @@ static function () use ( $permalink_structure ) {
* @since 1.0.0
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global string $table_prefix The database table prefix.
* @global string $base_prefix The database table prefix.
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
*/
public function clean_up() {
global $wpdb, $table_prefix, $wp_filesystem;
global $wpdb, $base_prefix, $wp_filesystem;

require_once ABSPATH . '/wp-admin/includes/upgrade.php';

$old_prefix = $wpdb->set_prefix( $table_prefix . 'pc_' );
$old_prefix = $wpdb->set_prefix( $base_prefix . 'pc_' );
$tables = $wpdb->tables();

foreach ( $tables as $table ) {
Expand Down Expand Up @@ -146,19 +146,19 @@ public function clean_up() {
* @since 1.3.0
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global string $table_prefix The database table prefix.
* @global string $base_prefix The database table prefix.
*
* @return bool True if the runtime environment is set up, false if not.
*/
public function is_set_up() {
global $wpdb, $table_prefix;
global $wpdb, $base_prefix;

if ( defined( 'WP_PLUGIN_CHECK_OBJECT_CACHE_DROPIN_VERSION' ) ) {
return true;
}

// Set the custom prefix to check for the runtime environment tables.
$old_prefix = $wpdb->set_prefix( $table_prefix . 'pc_' );
$old_prefix = $wpdb->set_prefix( $base_prefix . 'pc_' );

$tables_present = $wpdb->posts === $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->posts ) );

Expand Down
Loading