本文整理汇总了PHP中Kwf_Setup::configClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Setup::configClass方法的具体用法?PHP Kwf_Setup::configClass怎么用?PHP Kwf_Setup::configClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwf_Setup
的用法示例。
在下文中一共展示了Kwf_Setup::configClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public static function setUp($configClass = 'Kwf_Config_Web')
{
error_reporting(E_ALL & ~E_STRICT);
define('APP_PATH', getcwd());
Kwf_Setup::$configClass = $configClass;
if (PHP_SAPI == 'cli') {
//don't use cached setup on cli so clear-cache will always work even if eg. paths change
require_once dirname(__FILE__) . '/../Kwf/Util/Setup.php';
Kwf_Util_Setup::minimalBootstrap();
$setupCode = Kwf_Util_Setup::generateCode();
Zend_Registry::_unsetInstance();
eval(substr($setupCode, 5));
} else {
if (!@(include APP_PATH . '/cache/setup' . self::CACHE_SETUP_VERSION . '.php')) {
if (!file_exists(APP_PATH . '/cache/setup' . self::CACHE_SETUP_VERSION . '.php')) {
require_once dirname(__FILE__) . '/../Kwf/Util/Setup.php';
Kwf_Util_Setup::minimalBootstrapAndGenerateFile();
}
include APP_PATH . '/cache/setup' . self::CACHE_SETUP_VERSION . '.php';
}
}
Kwf_Benchmark::checkpoint('setUp');
}
示例2: setUp
public static function setUp($configClass = 'Kwf_Config_Web')
{
error_reporting(E_ALL & ~E_STRICT);
define('APP_PATH', getcwd());
Kwf_Setup::$configClass = $configClass;
if (PHP_SAPI == 'cli') {
//don't use cached setup on cli so clear-cache will always work even if eg. paths change
require_once dirname(__FILE__) . '/../Kwf/Util/Setup.php';
Kwf_Util_Setup::minimalBootstrap();
eval(substr(Kwf_Util_Setup::generateCode(), 5));
} else {
if (!@(include APP_PATH . '/cache/setup' . self::CACHE_SETUP_VERSION . '.php')) {
if (!file_exists(APP_PATH . '/cache/setup' . self::CACHE_SETUP_VERSION . '.php')) {
require_once dirname(__FILE__) . '/../Kwf/Util/Setup.php';
Kwf_Util_Setup::minimalBootstrapAndGenerateFile();
}
include APP_PATH . '/cache/setup' . self::CACHE_SETUP_VERSION . '.php';
}
}
if (!defined('VKWF_PATH') && PHP_SAPI != 'cli' && self::getBaseUrl() === null) {
//if server.baseUrl is not set try to auto detect it and generate config.local.ini accordingly
//this code is not used if server.baseUrl is set to "" in vkwf
if (!isset($_SERVER['PHP_SELF'])) {
echo "Can't detect baseUrl, PHP_SELF is not set\n";
exit(1);
}
$baseUrl = substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'));
if (substr($baseUrl, -16) == '/kwf/maintenance') {
$baseUrl = substr($baseUrl, 0, -16);
}
$cfg = "[production]\n";
$cfg .= "server.domain = \"{$_SERVER['HTTP_HOST']}\"\n";
$cfg .= "server.baseUrl = \"{$baseUrl}\"\n";
$cfg .= "setupFinished = false\n";
if (file_exists('config.local.ini') && filesize('config.local.ini') > 0) {
echo "config.local.ini already exists but server.baseUrl is not set\n";
exit(1);
}
if (!is_writable('.')) {
echo "'" . getcwd() . "' is not writable, can't create config.local.ini\n";
exit(1);
}
file_put_contents('config.local.ini', $cfg);
Kwf_Config_Web::reload();
Kwf_Config::deleteValueCache('server.domain');
Kwf_Config::deleteValueCache('server.baseUrl');
unlink('cache/setup' . self::CACHE_SETUP_VERSION . '.php');
echo "<h1>" . Kwf_Config::getValue('application.name') . "</h1>\n";
echo "<a href=\"{$baseUrl}/kwf/maintenance/setup\">[start setup]</a>\n";
exit;
}
if (isset($_SERVER['REQUEST_URI']) && substr($_SERVER['REQUEST_URI'], 0, 5) == '/kwf/') {
if (substr($_SERVER['REQUEST_URI'], 0, 9) == '/kwf/pma/' || $_SERVER['REQUEST_URI'] == '/kwf/pma') {
Kwf_Util_Pma::dispatch();
} else {
if ($_SERVER['REQUEST_URI'] == '/kwf/check') {
$ok = true;
$msg = '';
if (Kwf_Setup::hasDb()) {
$date = Kwf_Registry::get('db')->query("SELECT NOW()")->fetchColumn();
if (!$date) {
$ok = false;
$msg .= 'mysql connection failed';
}
}
if (file_exists('instance_startup')) {
//can be used while starting up autoscaling instances
$ok = false;
$msg .= 'instance startup in progress';
}
if (!$ok) {
header("HTTP/1.0 500 Error");
echo "<h1>Check failed</h1>";
echo $msg;
} else {
echo "ok";
}
exit;
}
}
}
Kwf_Benchmark::checkpoint('setUp');
}