web/wp-admin/admin.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    26 
    26 
    27 if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') )
    27 if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') )
    28 	define('WP_LOAD_IMPORTERS', true);
    28 	define('WP_LOAD_IMPORTERS', true);
    29 
    29 
    30 require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
    30 require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
       
    31 
       
    32 nocache_headers();
    31 
    33 
    32 if ( get_option('db_upgraded') ) {
    34 if ( get_option('db_upgraded') ) {
    33 	flush_rewrite_rules();
    35 	flush_rewrite_rules();
    34 	update_option( 'db_upgraded',  false );
    36 	update_option( 'db_upgraded',  false );
    35 
    37 
    49 		 * else run it less often to reduce load.
    51 		 * else run it less often to reduce load.
    50 		 *
    52 		 *
    51 		 * @since 2.8.4b
    53 		 * @since 2.8.4b
    52 		 */
    54 		 */
    53 		$c = get_blog_count();
    55 		$c = get_blog_count();
       
    56 		// If 50 or fewer sites, run every time. Else, run "about ten percent" of the time. Shh, don't check that math.
    54 		if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) {
    57 		if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) {
    55 			require_once( ABSPATH . WPINC . '/http.php' );
    58 			require_once( ABSPATH . WPINC . '/http.php' );
    56 			$response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) );
    59 			$response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) );
    57 			do_action( 'after_mu_upgrade', $response );
    60 			do_action( 'after_mu_upgrade', $response );
    58 			unset($response);
    61 			unset($response);
    63 
    66 
    64 require_once(ABSPATH . 'wp-admin/includes/admin.php');
    67 require_once(ABSPATH . 'wp-admin/includes/admin.php');
    65 
    68 
    66 auth_redirect();
    69 auth_redirect();
    67 
    70 
    68 nocache_headers();
       
    69 
       
    70 // Schedule trash collection
    71 // Schedule trash collection
    71 if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') )
    72 if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') )
    72 	wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
    73 	wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
    73 
    74 
    74 set_screen_options();
    75 set_screen_options();
    77 $time_format = get_option('time_format');
    78 $time_format = get_option('time_format');
    78 
    79 
    79 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'text', 'trackback', 'pingback'));
    80 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'text', 'trackback', 'pingback'));
    80 
    81 
    81 wp_enqueue_script( 'common' );
    82 wp_enqueue_script( 'common' );
    82 wp_enqueue_script( 'jquery-color' );
       
    83 
    83 
    84 $editing = false;
    84 $editing = false;
    85 
    85 
    86 if ( isset($_GET['page']) ) {
    86 if ( isset($_GET['page']) ) {
    87 	$plugin_page = stripslashes($_GET['page']);
    87 	$plugin_page = stripslashes($_GET['page']);
   185 	if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) {
   185 	if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) {
   186 		wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
   186 		wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
   187 		exit;
   187 		exit;
   188 	}
   188 	}
   189 
   189 
       
   190 	do_action( 'load-importer-' . $importer );
       
   191 
   190 	$parent_file = 'tools.php';
   192 	$parent_file = 'tools.php';
   191 	$submenu_file = 'import.php';
   193 	$submenu_file = 'import.php';
   192 	$title = __('Import');
   194 	$title = __('Import');
   193 
   195 
   194 	if (! isset($_GET['noheader']))
   196 	if (! isset($_GET['noheader']))