OSDN Git Service

backport 10845a747904cf2a6ddefbf9b6c07e1d769238c2 to 0.11.1 tag
authorscribu <mail@scribu.net>
Wed, 14 Aug 2013 14:40:20 +0000 (17:40 +0300)
committerscribu <mail@scribu.net>
Thu, 15 Aug 2013 19:06:48 +0000 (22:06 +0300)
features/core.feature
php/WP_CLI/CommandWithUpgrade.php
php/wp-cli.php

index 27818a6..e343be6 100644 (file)
@@ -95,7 +95,7 @@ Feature: Manage WordPress installation
     When I run `wp eval 'var_export( is_admin() );'`
     Then STDOUT should be:
       """
-      true
+      false
       """ 
 
     When I run `wp eval 'var_export( function_exists( 'media_handle_upload' ) );'`
index 8e3e6c8..cb45952 100644 (file)
@@ -220,6 +220,9 @@ abstract class CommandWithUpgrade extends \WP_CLI_Command {
        }
 
        protected function _list( $_, $format ) {
+               // Force WordPress to check for updates
+               call_user_func( $this->upgrade_refresh );
+
                $values = array(
                        'format' => 'table',
                        'fields' => $this->fields
index 27679af..8eacba1 100644 (file)
@@ -19,20 +19,14 @@ WP_CLI::get_runner()->before_wp_load();
 // Load wp-config.php code, in the global scope
 eval( WP_CLI::get_runner()->get_wp_config_code() );
 
-// Simulate a /wp-admin/ page load
-$_SERVER['PHP_SELF'] = '/wp-admin/index.php';
-define( 'WP_ADMIN', true );
-define( 'WP_NETWORK_ADMIN', false );
-define( 'WP_USER_ADMIN', false );
-
 // Load Core, mu-plugins, plugins, themes etc.
 require WP_CLI_ROOT . '/php/wp-settings-cli.php';
 
 // Fix memory limit. See http://core.trac.wordpress.org/ticket/14889
 @ini_set( 'memory_limit', -1 );
 
+// Load all the admin APIs, for convenience
 require ABSPATH . 'wp-admin/includes/admin.php';
-do_action( 'admin_init' );
 
 WP_CLI::get_runner()->after_wp_load();