OSDN Git Service

Ensuring that theme enable/disable commands are only ever run on multisite installs
authorMatt Boynes <mboynes@alleyinteractive.com>
Fri, 27 Dec 2013 20:41:44 +0000 (15:41 -0500)
committerMatt Boynes <mboynes@alleyinteractive.com>
Fri, 27 Dec 2013 20:41:44 +0000 (15:41 -0500)
php/commands/theme.php

index 40ef185..61c42f8 100644 (file)
@@ -153,6 +153,10 @@ class Theme_Command extends \WP_CLI\CommandWithUpgrade {
         *     wp theme enable twentythirteen --activate
         */
        public function enable( $args, $assoc_args ) {
+               if ( ! is_multisite() ) {
+                       WP_CLI::error( 'This is not a multisite install.' );
+               }
+
                $theme = $this->fetcher->get_check( $args[0] );
                $name = $theme->get( 'Name' );
 
@@ -197,6 +201,10 @@ class Theme_Command extends \WP_CLI\CommandWithUpgrade {
         *     wp theme disable twentythirteen --network
         */
        public function disable( $args, $assoc_args ) {
+               if ( ! is_multisite() ) {
+                       WP_CLI::error( 'This is not a multisite install.' );
+               }
+
                $theme = $this->fetcher->get_check( $args[0] );
                $name = $theme->get( 'Name' );