Sitewide plugins cleanup. Props nacin. see #11644

git-svn-id: http://svn.automattic.com/wordpress/trunk@12947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-02-04 18:50:36 +00:00
parent cf7da6eab8
commit 3894489a5f
3 changed files with 14 additions and 12 deletions

View File

@ -259,7 +259,7 @@ function get_plugins($plugin_folder = '') {
* @return bool True, if in the active plugins list. False, not in the list.
*/
function is_plugin_active( $plugin ) {
return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ) );
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
}
/**
@ -270,7 +270,7 @@ function is_plugin_active( $plugin ) {
* @param string $plugin Base plugin path from plugins directory.
* @return bool True, if active for the network, otherwise false.
*/
function is_plugin_active_for_network( $plugin ){
function is_plugin_active_for_network( $plugin ) {
if ( !is_multisite() )
return false;
@ -553,7 +553,7 @@ function delete_plugins($plugins, $redirect = '' ) {
* @return array invalid plugins, plugin as key, error as value
*/
function validate_active_plugins() {
$plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
$plugins = get_option( 'active_plugins', array() );
// validate vartype: array
if ( ! is_array( $plugins ) ) {
update_option( 'active_plugins', array() );
@ -562,7 +562,7 @@ function validate_active_plugins() {
if ( is_multisite() && is_super_admin() ) {
$network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
$plugins = array_merge( (array) $plugins, $network_plugins );
$plugins = array_merge( $plugins, $network_plugins );
}
if ( empty( $plugins ) )

View File

@ -1098,6 +1098,7 @@ function upgrade_300() {
* @since 3.0.0
*/
function upgrade_network() {
global $wp_current_db_version;
// 2.8
if ( $wp_current_db_version < 11549 ) {
$wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' );
@ -1110,8 +1111,8 @@ function upgrade_network() {
update_site_option( 'active_sitewide_plugins', $sitewide_plugins );
}
update_site_option( 'wpmu_sitewide_plugins', '' );
update_site_option( 'deactivated_sitewide_plugins', '' );
delete_site_option( 'wpmu_sitewide_plugins' );
delete_site_option( 'deactivated_sitewide_plugins' );
}
}

View File

@ -403,12 +403,7 @@ function wp_load_mu_plugins() {
*/
function wp_load_plugins() {
$plugins = array();
// Check for hacks file if the option is enabled
if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) )
$plugins[] = ABSPATH . 'my-hacks.php';
$active_plugins = (array) apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
$active_plugins = (array) get_option( 'active_plugins', array() );
// Get active network plugins
if ( is_multisite() ) {
@ -419,6 +414,12 @@ function wp_load_plugins() {
}
}
// Check for hacks file if the option is enabled
if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
_deprecated_file( 'my-hacks.php', '1.5' );
array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
}
if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
return $plugins;