Make WordPress Core

Changeset 48326


Ignore:
Timestamp:
07/05/2020 08:30:18 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Plugins: Use include_once instead of include in uninstall_plugin(), in case the plugin file is already included.

Props valchovski, pcfreak30.
Fixes #47796.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin.php

    r48172 r48326  
    659659
    660660                ob_start();
     661
     662                if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) {
     663                        define( 'WP_SANDBOX_SCRAPING', true );
     664                }
     665
    661666                wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
    662667                $_wp_plugin_file = $plugin;
    663                 if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) {
    664                         define( 'WP_SANDBOX_SCRAPING', true );
    665                 }
    666668                include_once WP_PLUGIN_DIR . '/' . $plugin;
    667669                $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin.
    … …  
    12531255
    12541256                define( 'WP_UNINSTALL_PLUGIN', $file );
     1257
    12551258                wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file );
    1256                 include WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php';
     1259                include_once WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php';
    12571260
    12581261                return true;
    … …  
    12661269
    12671270                wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file );
    1268                 include WP_PLUGIN_DIR . '/' . $file;
     1271                include_once WP_PLUGIN_DIR . '/' . $file;
    12691272
    12701273                add_action( "uninstall_{$file}", $callable );
    … …  
    22882291                define( 'WP_SANDBOX_SCRAPING', true );
    22892292        }
     2293
    22902294        wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
    22912295        include WP_PLUGIN_DIR . '/' . $plugin;
Note: See TracChangeset for help on using the changeset viewer.