OSDN Git Service

Output WP-CLI error if config file couldn't be created
authorTaylor Lovett <admin@taylorlovett.com>
Tue, 22 Oct 2013 02:27:19 +0000 (02:27 +0000)
committerTaylor Lovett <admin@taylorlovett.com>
Tue, 22 Oct 2013 02:27:19 +0000 (02:27 +0000)
php/commands/core.php

index 9965db4..22c5136 100644 (file)
@@ -196,9 +196,13 @@ class Core_Command extends WP_CLI_Command {
                }
 
                $out = Utils\mustache_render( 'wp-config.mustache', $assoc_args );
-               file_put_contents( ABSPATH . 'wp-config.php', $out );
 
-               WP_CLI::success( 'Generated wp-config.php file.' );
+               $bytes_written = file_put_contents( ABSPATH . 'wp-config.php', $out );
+               if ( ! $bytes_written ) {
+                       WP_CLI::error( 'Could not create new config file.' );
+               } else {
+                       WP_CLI::success( 'Generated wp-config.php file.' );
+               }
        }
 
        /**