Support network-wide plugin re-activation in upgrades and edits. props PeteMall, fixes #13216

git-svn-id: https://develop.svn.wordpress.org/trunk@14348 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2010-05-02 22:57:44 +00:00
parent 7fcda10d46
commit 63fa3e7f3f
3 changed files with 10 additions and 6 deletions

View File

@@ -55,6 +55,8 @@ case 'update':
fwrite($f, $newcontent);
fclose($f);
$network_wide = is_plugin_active_for_network( $file );
// Deactivate so we can test it.
if ( is_plugin_active($file) || isset($_POST['phperror']) ) {
if ( is_plugin_active($file) )
@@ -62,7 +64,7 @@ case 'update':
update_option('recently_activated', array($file => time()) + (array)get_option('recently_activated'));
wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto"));
wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide));
exit;
}
wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
@@ -83,7 +85,7 @@ default:
wp_die( $error );
if ( ! is_plugin_active($file) )
activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error
activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
exit;