public function getBackupLocation(DrupalSite $site, $component) { global $configs; $path = $site->getDocroot() . '/' . $site->getenvironment() . '/' . $site->getServer(); switch ($component) { case 'code': $path .= '/' . CODEDIR; break; case 'files': $path .= '/' . FILEDIR; break; case 'db': $path .= '/' . DBDIR; break; } if (isset($configs['backup'])) { File::checkDirectory($configs['backup'] . '/' . $path); return $configs['backup'] . '/' . $path; } else { File::checkDirectory(ROOT_DIR . '/backups/' . $path); return ROOT_DIR . '/backups/' . $path; } }
/** * @param array $cli * @param DrupalSite $conf * @return array */ private function getDownloadOptions($cli, DrupalSite $conf) { $downloads = !empty($cli) ? $cli : $conf->getBackup(); $allowed = ['db', 'code', 'files']; return array_intersect(array_combine($downloads, $downloads), $allowed); }