The panel that creates new backups.
768488
private function create()
    {
        try {
            callback_event('rah_backup.backup');
        } catch (Rah_Backup_Exception $e) {
            $this->browser(array($e->getMessage(), E_ERROR));
            return;
        } catch (Exception $e) {
            $this->browser(array(txpspecialchars($e->getMessage()), E_ERROR));
            return;
        }

        $this->browser(gTxt('rah_backup_done'));
    }
700139
private void backup(final FileObject _backup,
                        final int _number)
        throws FileSystemException
    {
        if (_number < this.numberBackup) {
            final FileObject backFile = this.manager.resolveFile(this.manager.getBaseFile(),
                    this.storeFileName + VFSStoreResource.EXTENSION_BACKUP + _number);
            if (backFile.exists()) {
                backup(backFile, _number + 1);
            }
            _backup.moveTo(backFile);
        } else {
            _backup.delete();
        }
    }
671351
private CompletableFuture<BackupResponse> backup(BackupRequest request) {
    return getService(request).thenCompose(service -> service.backup(request));
  }
78434
private void fillWeekPanel() {

        addCheckBox(WeekOfMonth.FIRST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_1_0);
        addCheckBox(WeekOfMonth.SECOND.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_2_0);
        addCheckBox(WeekOfMonth.THIRD.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_3_0);
        addCheckBox(WeekOfMonth.FOURTH.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_4_0);
        addCheckBox(WeekOfMonth.LAST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_5_0);
    }
532931
protected function actionListBackup()
    {
        list($selected, $action) = $this->getPostedAction();

        $deleted = 0;

        foreach ($selected as $id) {
            if ($action === 'delete' && $this->access('backup_delete')) {
                $deleted += (int) $this->backup->delete($id);
            }
        }

        if ($deleted > 0) {
            $message = $this->text('Deleted %num item(s)', array('%num' => $deleted));
            $this->setMessage($message, 'success');
        }
    }
1302372
def create_backup(self, instance, name, description=None):
        
        return instance.create_backup(name, description=description)
1264558
public function pane()
    {
        global $step;

        require_privs('rah_backup');

        $steps = array(
            'browser' => false,
            'create' => true,
            'download' => true,
            'multi_edit' => true,
        );

        if (!$step || !bouncer($step, $steps) || !has_privs('rah_backup_' . $step)) {
            $step = 'browser';
        }

        $this->$step();
    }
492081
def create_backup(self, instance, name, description=None):
        
        body = {"backup": {
                "instance": utils.get_id(instance),
                "name": name,
                }}
        if description is not None:
            body["backup"]["description"] = description
        uri = "/backups"
        resp, resp_body = self.api.method_post(uri, body=body)
        mgr = self.api._backup_manager
        return CloudDatabaseBackup(mgr, body.get("backup"))
1313745
private function startRestoreService( StorageboxData $data, $backupKey, Database $database, OutputInterface $output) {
		$stackName = $data->getBackup()->getStackName();

		$restoreService = new Service();
		$restoreService->setImage('ipunktbs/xtrabackup:1.1.1');
		$restoreService->setName('restore-'.$backupKey);
		$restoreService->setCommand('restore '.$backupKey);
		$restoreService->setRestart(Service::RESTART_START_ONCE);

		$mysqlVolume = $this->makeVolume($data);
		$backupVolume = $this->makeBackupVolume($database);
		$restoreService->addVolume( $mysqlVolume );
		$restoreService->addVolume( $backupVolume );

		/**
		 * @var SchedulerParser $schedulerParser
		 */
		//$schedulerParser = container(SchedulerParser::class);
		$schedulerParser = container('scheduler-parser');
		$config = new ArrayConfiguration([
			'scheduler' => [
				'should-have-tags' => [ 'primary-restore' ]
			]
		]);
		$schedulerParser->parse($restoreService, $config);


		$restoreInfrastructure = new Infrastructure();
		$restoreInfrastructure->addService($restoreService);

		$this->infrastructureWriter->setPath( $this->getWorkDirectory() )
			->setSkipClear(false)
			->write($restoreInfrastructure, new FileWriter());
		$output->writeln("Starting ".$restoreService->getName().".");
		$this->rancherService->start( $this->getWorkDirectory(), $stackName);
		$output->writeln("Waiting for ".$restoreService->getName()." to finish.");
		$this->rancherService->wait($stackName, $restoreService->getName(), new HealthStateMatcher('started-once') );
		$output->writeln($restoreService->getName()." finished.");

		return $restoreService;
	}
458044
private function makeBackup ()
    {
        $this->createDirectory($this->backupDirectory);
        $this->createDirectory($this->backupDirectory . '/config');

        File::copyDirectory('app', $this->backupDirectory . '/app');
        File::copyDirectory('bootstrap', $this->backupDirectory . '/bootstrap');
        File::copyDirectory('routes', $this->backupDirectory . '/routes');

        File::copy('composer.json', $this->backupDirectory . '/composer.json');
        File::copy('config/auth.php', $this->backupDirectory . '/config/auth.php');
        File::copy('config/database.php', $this->backupDirectory . '/config/database.php');
    }
684759
private function backupCurrentVersion()
    {
        $this->fs->copy($this->currentInstallerFile, $this->currentInstallerBackupFile, true);
        $this->restorePreviousInstaller = true;

        return $this;
    }
555651
public function apply()
    {
        $this->backup = new DirectoryReflection($this->content->getPath());

        $this->content->save();
    }
1216415
def _autodiscover(self):
        """"""
        if getattr(self, "_autodiscover_complete", False):
            return

        panels_to_discover = []
        panel_groups = []
        # If we have a flat iterable of panel names, wrap it again so
        # we have a consistent structure for the next step.
        if all([isinstance(i, six.string_types) for i in self.panels]):
            self.panels = [self.panels]

        # Now iterate our panel sets.
        default_created = False
        for panel_set in self.panels:
            # Instantiate PanelGroup classes.
            if not isinstance(panel_set, collections.Iterable) and \
                    issubclass(panel_set, PanelGroup):
                panel_group = panel_set(self)
            # Check for nested tuples, and convert them to PanelGroups
            elif not isinstance(panel_set, PanelGroup):
                panel_group = PanelGroup(self, panels=panel_set)

            # Put our results into their appropriate places
            panels_to_discover.extend(panel_group.panels)
            panel_groups.append((panel_group.slug, panel_group))
            if panel_group.slug == DEFAULT_PANEL_GROUP:
                default_created = True

        # Plugin panels can be added to a default panel group. Make sure such a
        # default group exists.
        if not default_created:
            default_group = PanelGroup(self)
            panel_groups.insert(0, (default_group.slug, default_group))
        self._panel_groups = collections.OrderedDict(panel_groups)

        # Do the actual discovery
        package = '.'.join(self.__module__.split('.')[:-1])
        mod = import_module(package)
        for panel in panels_to_discover:
            try:
                before_import_registry = copy.copy(self._registry)
                import_module('.%s.panel' % panel, package)
            except Exception:
                self._registry = before_import_registry
                if module_has_submodule(mod, panel):
                    raise
        self._autodiscover_complete = True
1322276
public function moveOldBackup()
    {
        Service::$log->msg('Filesystem: moving old backups');
        // remove the 2-day file
        if(file_exists($this->storagePath.'backup-2days-old')){
            unlink($this->storagePath.'backup-2days-old');
        }

        // copy current 1-day file to 2-day
        $sourceFile = $this->storagePath . 'backup-1day-old';
        $destinationFile = $this->storagePath . 'backup-2days-old';
        if (file_exists($sourceFile)) {
            copy($sourceFile, $destinationFile);
        }

        // remove the old 1-day file
        $destinationFileTemp = $this->storagePath. 'backup-1day-old';
        if (file_exists($destinationFileTemp)) {
            unlink($destinationFileTemp);
        }

        Service::$log->msg('Filesystem: moving old backups done');

        return $destinationFile;
    }
248131
protected function createBackupFile($original, $backup)
    {
        $isOk = !file_exists($original) || rename($original, $backup);

        return $isOk;
    }
264189
def cli(env, volume_id):
    """"""

    file_manager = SoftLayer.FileStorageManager(env.client)

    snapshot_schedules = file_manager.list_volume_schedules(volume_id)

    table = formatting.Table(['id',
                              'active',
                              'type',
                              'replication',
                              'date_created',
                              'minute',
                              'hour',
                              'day',
                              'week',
                              'day_of_week',
                              'date_of_month',
                              'month_of_year',
                              'maximum_snapshots'])

    for schedule in snapshot_schedules:

        if 'REPLICATION' in schedule['type']['keyname']:
            replication = '*'
        else:
            replication = formatting.blank()

        file_schedule_type = schedule['type']['keyname'].replace('REPLICATION_', '')
        file_schedule_type = file_schedule_type.replace('SNAPSHOT_', '')

        property_list = ['MINUTE', 'HOUR', 'DAY', 'WEEK',
                         'DAY_OF_WEEK', 'DAY_OF_MONTH',
                         'MONTH_OF_YEAR', 'SNAPSHOT_LIMIT']

        schedule_properties = []
        for prop_key in property_list:
            item = formatting.blank()
            for schedule_property in schedule.get('properties', []):
                if schedule_property['type']['keyname'] == prop_key:
                    if schedule_property['value'] == '-1':
                        item = '*'
                    else:
                        item = schedule_property['value']
                    break
            schedule_properties.append(item)

        table_row = [
            schedule['id'],
            '*' if schedule.get('active', '') else '',
            file_schedule_type,
            replication,
            schedule.get('createDate', '')
        ]
        table_row.extend(schedule_properties)
        table.add_row(table_row)

    env.fout(table)
325763
public function backupDb()
    {
        $database = new Database($this->connection);

        if (! $this->checkBackupIsPossible()) {
            $message = 'Your database is too big for an automatic backup';

            $this->log('error', $message);

            throw new UpdateException($message);
        }

        $this->backupFile = THELIA_ROOT . $this->backupDir . 'update.sql';
        $backupDir = THELIA_ROOT . $this->backupDir;

        $fs = new Filesystem();

        try {
            $this->log('debug', sprintf('Backup database to file : %s', $this->backupFile));

            // test if backup dir exists
            if (!$fs->exists($backupDir)) {
                $fs->mkdir($backupDir);
            }

            if (!is_writable($backupDir)) {
                throw new \RuntimeException(sprintf('impossible to write in directory : %s', $backupDir));
            }

            // test if backup file already exists
            if ($fs->exists($this->backupFile)) {
                // remove file
                $fs->remove($this->backupFile);
            }

            $database->backupDb($this->backupFile);
        } catch (\Exception $ex) {
            $this->log('error', sprintf('error during backup process with message : %s', $ex->getMessage()));
            throw $ex;
        }
    }