Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
miya0001 committed Jan 24, 2017
2 parents 3d6697c + d57387b commit c14f423
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
41 changes: 24 additions & 17 deletions cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class WP_CLI_Scaffold_Movefile extends WP_CLI_Command
*
* ## OPTIONS
*
* [--output]
* : Output the contents of the Movefile.
*
* [--force]
* : Overwrite Movefile that already exist.
*
Expand All @@ -38,33 +41,37 @@ class WP_CLI_Scaffold_Movefile extends WP_CLI_Command
function __invoke( $args, $assoc_args )
{
$vars = array(
'site_url' => site_url(),
'wordpress_path' => WP_CLI::get_runner()->config['path'],
'db_name' => DB_NAME,
'db_user' => DB_USER,
'db_pass' => DB_PASSWORD,
'db_host' => DB_HOST,
'db_charset' => DB_CHARSET,
'home_url' => home_url(),
'wordpress_path' => untrailingslashit( WP_CLI::get_runner()->config['path'] ),
'db_name' => DB_NAME,
'db_user' => DB_USER,
'db_pass' => DB_PASSWORD,
'db_host' => DB_HOST,
'db_charset' => DB_CHARSET,
);

$movefile = WP_CLI\Utils\mustache_render(
self::get_template(),
$vars
);

if ( empty( $args[0] ) ) {
$filename = getcwd() . "/Movefile";
if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'output' ) ) {
WP_CLI::line( $movefile );
} else {
$filename = $args[0];
}
if ( empty( $args[0] ) ) {
$filename = getcwd() . "/Movefile";
} else {
$filename = $args[0];
}

$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
$result = $this->create_file( $filename, $movefile, $force );
$force = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
$result = $this->create_file( $filename, $movefile, $force );

if ( $result ) {
WP_CLI::success( $filename );
} else {
WP_CLI::success( "Movefile wasn't overwrited." );
if ( $result ) {
WP_CLI::success( $filename );
} else {
WP_CLI::success( "Movefile wasn't overwrited." );
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion templates/Movefile.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local:
vhost: "{{ site_url }}"
vhost: "{{ home_url }}"
wordpress_path: "{{ wordpress_path }}" # use an absolute path here

database:
Expand Down

0 comments on commit c14f423

Please sign in to comment.