/** * Enable a site in Apache web-server * * @param string $siteName * @return mixed */ protected static function apacheEnableSite($siteName) { System_Daemon::debug('Enabling ' . $siteName); $confFile = DaemonConfig::$distro->APACHE_SITES_DIR . '/' . $siteName . '.conf'; switch (DaemonConfig::$cfg->DistName) { case 'CentOS': if (file_exists($confFile . '.disabled')) { $command = DaemonConfig::$cmd->CMD_MV . ' -f ' . $confFile . '.disabled ' . $confFile; } break; default: if (file_exists($confFile)) { $command = DaemonConfig::$cmd->CMD_HTTPD_A2ENSITE . ' ' . $siteName . '.conf 1>&1 2>&1'; } } if (isset($command) && $command != '') { System_Daemon::debug('Doing: ' . $command); exec($command, $result, $error); } else { $result = ''; $error = 0; } if ($error == 0) { System_Daemon::debug('Enabled ' . $siteName); } else { $msg = 'Failed to enable ' . $siteName; System_Daemon::debug($msg); System_Daemon::debug(DaemonCommon::listArrayforLOG($result)); return $msg . '<br />' . (DaemonConfig::$cfg->DEBUG == '1' ? DaemonCommon::listArrayforGUI($result) : ''); } return true; }