コード例 #1
0
ファイル: ConfigBase.php プロジェクト: jmolivas/backup_oop
 protected function getServers()
 {
     $servers = [];
     foreach (File::loadFiles(CONFIG . '/servers', '/.*\\.yml/') as $server_conf) {
         $server = Yaml::parse($server_conf->uri);
         if (empty($this->servers) || in_array($server['machine'], $this->servers)) {
             $servers[$server['machine']] = $server + $this->serverDefaults();
         }
     }
     return $servers;
 }
コード例 #2
0
 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;
     }
 }