Make WordPress Core

Ticket #7113: 7113.diff

File 7113.diff, 2.4 KB (added by DD32, 17 years ago)
  • wp-admin/includes/plugin.php

     
    2222                $plugin = '<a href="' . trim( $plugin_uri[1] ) . '" title="'.__( 'Visit plugin homepage' ).'">'.$plugin.'</a>';
    2323        }
    2424
    2525        if ('' == $author_uri[1] ) {
    2626                $author = trim( $author_name[1] );
    2727        } else {
    2828                $author = '<a href="' . trim( $author_uri[1] ) . '" title="'.__( 'Visit author homepage' ).'">' . trim( $author_name[1] ) . '</a>';
    2929        }
    3030
    3131        return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version);
    3232}
    3333
    3434function get_plugins($plugin_folder = '') {
    35         global $wp_plugins;
    3635
    37         if ( isset( $wp_plugins ) ) {
    38                 return $wp_plugins;
    39         }
     36        $cache_plugins = wp_cache_get('plugins', 'plugins');
     37        if( $cache_plugins[ $plugin_folder ] )
     38                return $cache_plugins[ $plugin_folder ];
    4039
    4140        $wp_plugins = array ();
    4241        $plugin_root = WP_PLUGIN_DIR;
     
    8584
    8685        uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
    8786
     87        $cache_plugins[ $plugin_folder ] = $wp_plugins;
     88        wp_cache_set('plugins', $cache_plugins, 'plugins');
     89
    8890        return $wp_plugins;
    8991}
    9092
  • wp-admin/plugins.php

     
    8383
    8484                        $delete_result = delete_plugins($plugins);
    8585                       
    86                         //HACK TIME!
    87                         // Proper way needed, perhaps get_plugins() to convert to wp_cache_get() any reason why it hasnt allready?
    88                         // This clears the cached plugin list
    89                         global $wp_plugins;
    90                         $wp_plugins = null;
    91                        
    92                        
    93                                
    94                         //TODO: Implement!.. STAT!
     86                        wp_cache_delete('plugins', 'plugins');
     87
    9588                        break;
    9689                default:
    9790                        var_dump("Unknown Action $action");
  • wp-settings.php

     
    222222wp_cache_init();
    223223if ( function_exists('wp_cache_add_global_groups') ) {
    224224        wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta'));
    225         wp_cache_add_non_persistent_groups(array( 'comment', 'counts' ));
     225        wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
    226226}
    227227
    228228require (ABSPATH . WPINC . '/plugin.php');