HM\BackUpWordPress\Backup::perform_backup PHP Method

perform_backup() public method

Perform the backup by iterating through each Backup_Engine in turn until we find one which works. If a backup filename or any excludes have been set then those are passed to each Backup_Engine.
public perform_backup ( array $backup_engines ) : Backup_Engine | false
$backup_engines array
return Backup_Engine | false The successful backup engine or false on failure.
    public function perform_backup(array $backup_engines)
    {
        foreach ($backup_engines as $backup_engine) {
            /**
             * If the backup_engine completes the backup then we
             * clear any errors or warnings from previously failed backup_engines
             * and return the successful one.
             */
            if ($backup_engine->backup()) {
                $this->errors = array();
                $this->warnings = $backup_engine->get_warnings();
                return $backup_engine;
            }
            // Store all the errors and warnings as they are shown if all engines fail
            $this->warnings = array_merge($this->warnings, $backup_engine->get_warnings());
            $this->errors = array_merge($this->errors, $backup_engine->get_errors());
        }
        return false;
    }