core/classes/Console.class.php
public function dbRestore($args){

        $path = '/app/db/';
        if(isset($args[0])){
            $path = $args[0];
        }//if

        $path = \App::path() . '/' . trim($path,'/') . '/';

        $fileName = \App::config('DB_DB');
        if(isset($args[1])){
            $fileName = $args[1];
        }//if

        $fileName = $path . $fileName . '.sql';

        if(!is_file($fileName)){
            echo "Backup `{$fileName}` does not exist, exiting." . PHP_EOL;
            exit;
        }//if

        $e = "mysql -u %1\$s -p'%2\$s' -h %3\$s %4\$s < %5\$s;";
        $e = sprintf($e,
            \App::config('DB_USER'),
            \App::config('DB_PASSWORD'),
            \App::config('DB_HOST'),
            \App::config('DB_DB'),
            $fileName
        );

        $error = exec($e);

        if(!$error){
            echo 'DB `' . \App::config('DB_DB') . "` successfully restored from `{$fileName}`";
        } else {
            echo 'Unable to restore! : ' . $error;
        }//el

        echo PHP_EOL;

    }
public function dbRestore($args){

        $path = '/app/db/';
        if(isset($args[0])){
            $path = $args[0];
        }//if

        $path = \App::path() . '/' . trim($path,'/') . '/';

        $fileName = \App::config('DB_DB');
        if(isset($args[1])){
            $fileName = $args[1];
        }//if

        $fileName = $path . $fileName . '.sql';

        if(!is_file($fileName)){
            echo "Backup `{$fileName}` does not exist, exiting." . PHP_EOL;
            exit;
        }//if

        $e = "mysql -u %1\$s -p'%2\$s' -h %3\$s %4\$s < %5\$s;";
        $e = sprintf($e,
            \App::config('DB_USER'),
            \App::config('DB_PASSWORD'),
            \App::config('DB_HOST'),
            \App::config('DB_DB'),
            $fileName
        );

        $error = exec($e);

        if(!$error){
            echo 'DB `' . \App::config('DB_DB') . "` successfully restored from `{$fileName}`";
        } else {
            echo 'Unable to restore! : ' . $error;
        }//el

        echo PHP_EOL;

    }
public function dbRestore ( $ args ) { $ path = '/app/db/' ; if ( isset ( $ args [ 0 ] ) ) { $ path = $ args [ 0 ] ; } //if $ path = \ App :: path ( ) . '/' . trim ( $ path , '/' ) . '/' ; $ fileName = \ App :: config ( 'DB_DB' ) ; if ( isset ( $ args [ 1 ] ) ) { $ fileName = $ args [ 1 ] ; } //if $ fileName = $ path . $ fileName . '.sql' ; if ( ! is_file ( $ fileName ) ) { echo "Backup `{$fileName}` does not exist, exiting." . PHP_EOL ; exit ; } //if $ e = "mysql -u %1\$s -p'%2\$s' -h %3\$s %4\$s < %5\$s;" ; $ e = sprintf ( $ e , \ App :: config ( 'DB_USER' ) , \ App :: config ( 'DB_PASSWORD' ) , \ App :: config ( 'DB_HOST' ) , \ App :: config ( 'DB_DB' ) , $ fileName ) ; $ error = exec ( $ e ) ; if ( ! $ error ) { echo 'DB `' . \ App :: config ( 'DB_DB' ) . "` successfully restored from `{$fileName}`" ; } else { echo 'Unable to restore! : ' . $ error ; } //el echo PHP_EOL ; }
Restore the DB from a backup.

eg: `db-restore`
eg: `db-restore /app/db/`
eg `db-restore /app/db/ BACKUP.sql`

@param array $args The arguements.
Restore the DB from a backup .