Make WordPress Core


Ignore:
Timestamp:
01/25/2007 08:45:20 PM (17 years ago)
Author:
markjaquith
Message:

Prevent plugins that generate PHP fatal errors from being activated. ticket #3254

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/plugins.php

    r4664 r4811  
    1212            wp_die(__('Plugin file does not exist.'));
    1313        if (!in_array($plugin, $current)) {
     14            wp_redirect('plugins.php?error=true'); // we'll override this later if the plugin can be included without fatal error
     15            @include(ABSPATH . PLUGINDIR . '/' . $plugin);
    1416            $current[] = $plugin;
    1517            sort($current);
    1618            update_option('active_plugins', $current);
    17             include(ABSPATH . PLUGINDIR . '/' . $plugin);
    1819            do_action('activate_' . $plugin);
    1920        }
    20         wp_redirect('plugins.php?activate=true');
     21        wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
    2122    } else if ('deactivate' == $_GET['action']) {
    2223        check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
     
    5960?>
    6061
    61 <?php if (isset($_GET['activate'])) : ?>
    62 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p>
    63 </div>
    64 <?php endif; ?>
    65 <?php if (isset($_GET['deactivate'])) : ?>
    66 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p>
    67 </div>
     62<?php if ( isset($_GET['error']) ) : ?>
     63    <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p></div>
     64<?php elseif ( isset($_GET['activate']) ) : ?>
     65    <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
     66<?php elseif ( isset($_GET['deactivate']) ) : ?>
     67    <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
    6868<?php endif; ?>
    6969
Note: See TracChangeset for help on using the changeset viewer.