Ticket #20468: 20468.2.patch
File 20468.2.patch, 5.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/plugins.php
54 54 $recent = (array) get_option( 'recently_activated' ); 55 55 unset( $recent[ $plugin ] ); 56 56 update_option( 'recently_activated', $recent ); 57 } else { 58 $recent = (array) get_site_option( 'recently_activated' ); 59 unset( $recent[ $plugin ] ); 60 update_site_option( 'recently_activated', $recent ); 57 61 } 58 62 59 63 if ( isset($_GET['from']) && 'import' == $_GET['from'] ) { … … 96 100 97 101 if ( ! is_network_admin() ) { 98 102 $recent = (array) get_option('recently_activated' ); 99 foreach ( $plugins as $plugin ) 100 unset( $recent[ $plugin ] ); 103 } else { 104 $recent = (array) get_site_option('recently_activated' ); 105 } 106 107 foreach ( $plugins as $plugin ) { 108 unset( $recent[ $plugin ] ); 109 } 110 111 if ( ! is_network_admin() ) { 101 112 update_option( 'recently_activated', $recent ); 113 } else { 114 update_site_option( 'recently_activated', $recent ); 102 115 } 103 116 104 117 wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") ); … … 165 178 } 166 179 167 180 deactivate_plugins( $plugin, false, is_network_admin() ); 168 if ( ! is_network_admin() ) 181 182 if ( ! is_network_admin() ) { 169 183 update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); 184 } else { 185 update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); 186 } 187 170 188 if ( headers_sent() ) 171 189 echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; 172 190 else … … 194 212 195 213 deactivate_plugins( $plugins, false, is_network_admin() ); 196 214 215 $deactivated = array(); 216 foreach ( $plugins as $plugin ) { 217 $deactivated[ $plugin ] = time(); 218 } 219 197 220 if ( ! is_network_admin() ) { 198 $deactivated = array();199 foreach ( $plugins as $plugin )200 $deactivated[ $plugin ] = time();201 221 update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); 222 } else { 223 update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) ); 202 224 } 203 225 204 226 wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") ); … … 354 376 exit; 355 377 356 378 case 'clear-recent-list': 357 if ( ! is_network_admin() ) 379 if ( ! is_network_admin() ) { 358 380 update_option( 'recently_activated', array() ); 381 } else { 382 update_site_option( 'recently_activated', array() ); 383 } 359 384 break; 360 385 } 361 386 } -
src/wp-admin/plugin-editor.php
71 71 if ( is_plugin_active($file) ) 72 72 deactivate_plugins($file, true); 73 73 74 if ( ! is_network_admin() ) 74 if ( ! is_network_admin() ) { 75 75 update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) ); 76 } else { 77 update_site_option( 'recently_activated', array( $file => time() ) + (array) get_site_option( 'recently_activated' ) ); 78 } 76 79 77 80 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)); 78 81 exit; -
src/wp-admin/includes/class-wp-plugins-list-table.php
129 129 130 130 set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS ); 131 131 132 if ( ! $screen->in_admin( 'network' ) ) { 132 if ( $screen->in_admin( 'network' ) ) { 133 $recently_activated = get_site_option( 'recently_activated', array() ); 134 } else { 133 135 $recently_activated = get_option( 'recently_activated', array() ); 136 } 137 138 foreach ( $recently_activated as $key => $time ) { 139 if ( $time + WEEK_IN_SECONDS < time() ) { 140 unset( $recently_activated[$key] ); 141 } 142 } 134 143 135 foreach ( $recently_activated as $key => $time )136 if ( $time + WEEK_IN_SECONDS < time() )137 unset( $recently_activated[$key] );144 if ( $screen->in_admin( 'network' ) ) { 145 update_site_option( 'recently_activated', $recently_activated ); 146 } else { 138 147 update_option( 'recently_activated', $recently_activated ); 139 148 } 140 149 … … 170 179 // On the network-admin screen, populate the active list with plugins that are network activated 171 180 $plugins['active'][ $plugin_file ] = $plugin_data; 172 181 } else { 173 if ( ! $screen->in_admin( 'network' ) &&isset( $recently_activated[ $plugin_file ] ) ) {174 // On the non-network screen, populate the recently activated list with plugins that have been recently activated182 if ( isset( $recently_activated[ $plugin_file ] ) ) { 183 // Populate the recently activated list with plugins that have been recently activated 175 184 $plugins['recently_activated'][ $plugin_file ] = $plugin_data; 176 185 } 177 186 // Populate the inactive list with plugins that aren't activated … … 400 409 401 410 echo '<div class="alignleft actions">'; 402 411 403 if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' === $status ) {412 if ( 'recently_activated' == $status ) { 404 413 submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false ); 405 414 } elseif ( 'top' === $which && 'mustuse' === $status ) { 406 415 echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>';