WordPress.org

Make WordPress Core

Ticket #22802: plugin-file-hooks.diff

File plugin-file-hooks.diff, 1.1 KB (added by MikeSchinkel, 16 months ago)

Adds 'uninstall_plugin_file' and 'activate_plugin_file' hooks.

  • wp-admin/includes/plugin.php

     
    859859                update_option('uninstall_plugins', $uninstallable_plugins); 
    860860                unset($uninstallable_plugins); 
    861861 
    862                 include WP_PLUGIN_DIR . '/' . $file; 
     862                include apply_filters( 'uninstall_plugin_file', WP_PLUGIN_DIR . '/' . $file ); 
    863863 
    864864                add_action( 'uninstall_' . $file, $callable ); 
    865865                do_action( 'uninstall_' . $file ); 
  • wp-admin/plugins.php

     
    144144                        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. 
    145145                        // Go back to "sandbox" scope so we get the same errors as before 
    146146                        function plugin_sandbox_scrape( $plugin ) { 
    147                                 include( WP_PLUGIN_DIR . '/' . $plugin ); 
     147                                include( apply_filters( 'activate_plugin_file', WP_PLUGIN_DIR . '/' . $plugin ) ); 
    148148                        } 
    149149                        plugin_sandbox_scrape( $plugin ); 
    150150                        do_action('activate_' . $plugin);