/** * @brief config 파일을 생성 * 모든 설정이 이상없이 끝난 후에 config파일 생성 **/ function makeConfigFile() { $config_file = Context::getConfigFile(); //if(file_exists($config_file)) return; $db_info = Context::getDbInfo(); if (!$db_info) { return; } $buff = '<?php if(!defined("__ZBXE__")) exit();' . "\n"; foreach ($db_info as $key => $val) { $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); } $buff .= "?>"; FileHandler::writeFile($config_file, $buff); if (@file_exists($config_file)) { return true; } return false; }
/** * Checks whether XE is installed * * @return bool True if the config file exists, otherwise false. */ function isInstalled() { return FileHandler::hasContent(Context::getConfigFile()); }
/** * @brief Create config file * Create the config file when all settings are completed */ function makeConfigFile() { try { $config_file = Context::getConfigFile(); //if(file_exists($config_file)) return; $db_info = Context::getDbInfo(); if (!$db_info) { return; } $buff = $this->_getDBConfigFileContents($db_info); FileHandler::writeFile($config_file, $buff); if (@file_exists($config_file)) { FileHandler::removeFile($this->db_tmp_config_file); FileHandler::removeFile($this->etc_tmp_config_file); return true; } return false; } catch (Exception $e) { return false; } }
/** * @brief 설치가 되어 있는지에 대한 체크 * * 단순히 db config 파일의 존재 유무로 설치 여부를 체크한다 **/ function isInstalled() { return file_exists(Context::getConfigFile()) && filesize(Context::getConfigFile()); }