From 3894489a5f98a7a242f048f7ac58b290823fcc41 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 4 Feb 2010 18:50:36 +0000 Subject: [PATCH] Sitewide plugins cleanup. Props nacin. see #11644 git-svn-id: http://svn.automattic.com/wordpress/trunk@12947 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/plugin.php | 8 ++++---- wp-admin/includes/upgrade.php | 5 +++-- wp-includes/load.php | 13 +++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 9e69646f9b..87c66ea4f3 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -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 ) ) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 13080fb036..b49cd6914c 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -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' ); } } diff --git a/wp-includes/load.php b/wp-includes/load.php index 794abbedc1..c3d27961a0 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -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;