Changeset 41819 for trunk/src/wp-admin/includes/plugin.php
- Timestamp:
- 10/11/2017 12:02:30 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/plugin.php
r41806 r41819 564 564 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error 565 565 ob_start(); 566 567 plugin_sandbox_scrape( $plugin ); 566 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); 567 $_wp_plugin_file = $plugin; 568 include_once( WP_PLUGIN_DIR . '/' . $plugin ); 569 $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin. 568 570 569 571 if ( ! $silent ) { … … 1897 1899 1898 1900 /** 1899 * Simulate loading the WordPress admin with a given plugin active to attempt to generate errors. 1900 * 1901 * Actions are re-triggered in the WP bootstrap process for the WP Admin, and the WP_ADMIN constant is defined. 1901 * Load a given plugin attempt to generate errors. 1902 1902 * 1903 1903 * @since 3.0.0 1904 1904 * @since 4.4.0 Function was moved into the `wp-admin/includes/plugin.php` file. 1905 * @since 4.9.0 Add defining of WP_ADMIN and triggering admin WP bootstrap actions. 1906 * 1907 * @global array $wp_actions 1905 * 1908 1906 * @param string $plugin Plugin file to load. 1909 1907 */ 1910 1908 function plugin_sandbox_scrape( $plugin ) { 1911 global $wp_actions;1912 1909 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); 1913 1914 if ( ! defined( 'WP_ADMIN' ) ) { 1915 define( 'WP_ADMIN', true ); 1916 } 1917 1918 $tested_actions = array( 1919 'setup_theme' => array(), 1920 'after_setup_theme' => array(), 1921 'init' => array(), 1922 'wp_loaded' => array(), 1923 'admin_init' => array(), 1924 ); 1925 $old_wp_actions = $wp_actions; 1926 array_map( 'remove_all_actions', array_keys( $tested_actions ) ); 1927 1928 include_once( WP_PLUGIN_DIR . '/' . $plugin ); 1929 1930 // Trigger key actions that are done on the plugin editor to cause the relevant plugin hooks to fire and potentially cause errors. 1931 foreach ( $tested_actions as $action => $args ) { 1932 do_action_ref_array( $action, $args ); 1933 } 1934 1935 $wp_actions = $old_wp_actions; // Restore actions. 1936 } 1910 include( WP_PLUGIN_DIR . '/' . $plugin ); 1911 }
Note: See TracChangeset
for help on using the changeset viewer.