WordPress.org

Make WordPress Core

Changeset 8495


Ignore:
Timestamp:
07/29/2008 11:10:12 PM (10 years ago)
Author:
azaozz
Message:

Include only valid plugins. Props guillep2k, fixes #6871

Location:
trunk
Files:
3 edited

Legend:

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

    r8402 r8495  
    305305    }
    306306
     307    //Invalid is any plugin that is deactivated due to error.
     308    $invalid = array();
     309
    307310    // If a plugin file does not exist, remove it from the list of active
    308311    // plugins.
     
    310313        $result = validate_plugin($check_plugin);
    311314        if ( is_wp_error( $result ) ) {
     315            $invalid[$check_plugin] = $result;
    312316            deactivate_plugins( $check_plugin, true);
    313317        }
    314318    }
     319    return $invalid;
    315320}
    316321
  • trunk/wp-admin/plugins.php

    r8368 r8495  
    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 <em>"%s"</em>.'), $plugin_file, $error->get_error_message()) . '</p></div>';
    170172?>
    171173
  • trunk/wp-settings.php

    r8470 r8495  
    422422    if ( is_array($current_plugins) ) {
    423423        foreach ($current_plugins as $plugin) {
    424             if ('' != $plugin && file_exists(WP_PLUGIN_DIR . '/' . $plugin))
     424            if ( '' != $plugin && ! 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.