From 810fcbb6abd45f9bf684347aa1f12aee306097c4 Mon Sep 17 00:00:00 2001 From: Lukas Leitsch Date: Wed, 1 Nov 2017 12:50:27 +0100 Subject: [PATCH] use runcommand for running the db commands --- cli.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/cli.php b/cli.php index 3996367..ed8095b 100644 --- a/cli.php +++ b/cli.php @@ -42,14 +42,7 @@ function create( $args, $assoc_args ) { $backup_dir = untrailingslashit( Functions::tempdir( 'VAK' ) ); - WP_CLI::launch_self( - "db export", - array( $backup_dir . "/wordpress.sql" ), - array(), - true, - true, - array( 'path' => WP_CLI::get_runner()->config['path'] ) - ); + WP_CLI::runcommand( "db export " . $backup_dir . "/wordpress.sql" ); file_put_contents( $backup_dir . '/manifest.json', @@ -107,14 +100,7 @@ function restore( $args, $assoc_args ) Functions::rcopy( $tmp_dir . '/wordpress', ABSPATH, array() ); if ( is_file( $tmp_dir . "/wordpress.sql" ) ) { - $result = WP_CLI::launch_self( - "db import", - array( $tmp_dir . "/wordpress.sql" ), - array(), - true, - true, - array( 'path' => WP_CLI::get_runner()->config['path'] ) - ); + $result = WP_CLI::runcommand( "db import " . $tmp_dir . "/wordpress.sql" ); if ( $result->return_code ) { Functions::rrmdir( $tmp_dir ); WP_CLI::error( sprintf( "Can't import database from '%s'.", $args[0] ) );