/** * Fire command */ public function fire() { $maxAgeInDays = Settings::get('max_age_in_days'); if ($this->option('force') || $this->confirm(trans('renatio.backupmanager::lang.clean.confirm', ['days' => $maxAgeInDays]), true)) { $this->cleanAll($maxAgeInDays); } else { $this->info(trans('renatio.backupmanager::lang.clean.aborted')); } return true; }
/** * Prepare files for backup action * * @return array */ public function prepareFiles() { $this->getFiles(); $fileBackupHandler = $this->fileHandler->setIncludedFiles(Settings::setBackupPaths($this->settings->include))->setExcludedFiles(Settings::setBackupPaths($this->settings->exclude)); foreach ($fileBackupHandler->getFilesToBeBackedUp() as $file) { $this->files[] = ['realFile' => $file, 'fileInZip' => 'files/' . $file]; $this->setFiles(); } Session::put('backup.type', 'app'); return $this; }
/** * Register scheduled commands * * @param $schedule */ public function registerSchedule($schedule) { $settings = Settings::instance(); // Backup database if ($settings['db_scheduler']) { $schedule->call(function () { Artisan::call('backup:run', ['--only-db' => true]); })->{$settings['db_scheduler']}(); } // Backup application if ($settings['app_scheduler']) { $schedule->command('backup:run')->{$settings['app_scheduler']}(); } // Clean old backups if ($settings['clean_scheduler']) { $schedule->command('backup:clean')->{$settings['clean_scheduler']}(); } }
/** * Determine if the dump should use extended-insert. * * @return string */ protected function useExtendedInsert() { return Settings::get('use_extended_insert'); }
/** * Save backup record */ public static function saveRecord() { $backup = Session::pull('backup'); $filePath = $backup['file_path']; self::create(['disk_name' => basename($filePath), 'file_path' => $filePath, 'type' => $backup['type'], 'filesystems' => implode(', ', Settings::get('filesystem'))]); }
/** * Get the path to the pg_dump. * * @return string */ protected function getDumpCommandPath() { return Settings::get('dump_command_path'); }