Пример #1
0
 /**
  * Execute the console command.
  *
  * @return bool
  */
 public function fire()
 {
     $manager = BackupManager::instance();
     $this->info(trans('renatio.backupmanager::lang.backup_command.start'));
     /*
      * Dump database
      */
     $this->comment(trans('renatio.backupmanager::lang.backups.dump_database'));
     $manager->dumpDatabase();
     /*
      * Prepare files for backup
      */
     if (!$this->option('only-db')) {
         $this->comment(trans('renatio.backupmanager::lang.backups.prepare_files'));
         $manager->prepareFiles();
     }
     /*
      * Compress files
      */
     $this->comment(trans('renatio.backupmanager::lang.backups.compress_files'));
     $manager->compressFiles();
     /*
      * Copy files to storage
      */
     $this->comment(trans('renatio.backupmanager::lang.backups.copy_files'));
     $manager->copyFiles();
     $this->info(trans('renatio.backupmanager::lang.backups.backup_success'));
 }
Пример #2
0
 /**
  * Fire command
  *
  * @return bool
  */
 public function fire()
 {
     $manager = BackupManager::instance();
     if ($this->askBackupId()) {
         /*
          * Get dump file
          */
         $this->comment(trans('renatio.backupmanager::lang.restore.preparing_files'));
         $manager->getDumpFile($this->option('backup-id'));
         /*
          * Restore database
          */
         $this->comment(trans('renatio.backupmanager::lang.restore.restoring_db'));
         $manager->restoreDB();
         $this->info(trans('renatio.backupmanager::lang.restore.success'));
         return true;
     }
 }
Пример #3
0
 /**
  * Run a specific backup/restore step
  *
  * @return mixed
  * @throws ApplicationException
  */
 public function onExecuteStep()
 {
     /*
      * Address timeout limits
      */
     @set_time_limit(3600);
     $manager = BackupManager::instance();
     $stepCode = post('code');
     switch ($stepCode) {
         case 'dumpDatabase':
             $manager->dumpDatabase();
             break;
         case 'prepareFiles':
             $manager->prepareFiles();
             break;
         case 'compressFiles':
             $manager->compressFiles();
             break;
         case 'copyFiles':
             $manager->copyFiles();
             break;
         case 'getDumpFile':
             $manager->getDumpFile();
             break;
         case 'restoreDatabase':
             $manager->restoreDB();
             break;
         case 'completeRestore':
             Flash::success(trans('renatio.backupmanager::lang.restore.success'));
             return Redirect::refresh();
         case 'completeBackup':
             Flash::success(trans('renatio.backupmanager::lang.backups.backup_success'));
             return Redirect::refresh();
     }
 }