WordPress.org

Make WordPress Core

Changeset 8500


Ignore:
Timestamp:
07/30/08 06:48:03 (6 years ago)
Author:
westi
Message:

Include only valid plugins. Props guillep2k and xknown, fixes #6871 for 2.6.1

Location:
branches/2.6
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/wp-admin/includes/plugin.php

    r8266 r8500  
    240240    } 
    241241 
     242    //Invalid is any plugin that is deactivated due to error. 
     243    $invalid = array();  
     244 
    242245    // If a plugin file does not exist, remove it from the list of active 
    243246    // plugins. 
     
    245248        $result = validate_plugin($check_plugin); 
    246249        if ( is_wp_error( $result ) ) { 
     250            $invalid[$check_plugin] = $result; 
    247251            deactivate_plugins( $check_plugin, true); 
    248252        } 
    249253    } 
     254    return $invalid; 
    250255} 
    251256 
  • branches/2.6/wp-admin/plugins.php

    r8218 r8500  
    166166require_once('admin-header.php'); 
    167167 
    168 validate_active_plugins(); 
    169  
     168$invalid = validate_active_plugins(); 
     169if( !empty($invalid) ) 
     170    foreach($invalid as $plugin_file => $error) 
     171        echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), wp_specialchars($plugin_file), $error->get_error_message()) . '</p></div>'; 
    170172?> 
    171173 
  • branches/2.6/wp-settings.php

    r8471 r8500  
    422422    if ( is_array($current_plugins) ) { 
    423423        foreach ($current_plugins as $plugin) { 
    424             if ('' != $plugin && file_exists(WP_PLUGIN_DIR . '/' . $plugin)) 
     424            if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) ) 
    425425                include_once(WP_PLUGIN_DIR . '/' . $plugin); 
    426426        } 
Note: See TracChangeset for help on using the changeset viewer.