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;
}