/**
  * Restore database
  *
  * @throws Exception
  */
 public function restoreDatabase()
 {
     $backups = Backup::all();
     $dumpFile = storage_path('temp/db/dump.sql');
     $this->getDatabase()->restore($dumpFile);
     File::delete($dumpFile);
     $this->seedBackupsTable($backups);
 }
Example #2
0
 /**
  * Ask question about backup id
  *
  * @return bool
  */
 private function askBackupId()
 {
     $backups = BackupModel::all();
     if (!$backups) {
         $this->info(trans('renatio.backupmanager::lang.restore.no_backups'));
         return false;
     }
     $backupId = $this->getBackupIdOption($backups);
     if (!BackupModel::find($backupId)) {
         $this->error(trans('renatio.backupmanager::lang.restore.backup_not_exist'));
         return false;
     }
     $this->input->setOption('backup-id', $backupId);
     return true;
 }