本文整理汇总了PHP中DevblocksPlatform::versionConsistencyCheck方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::versionConsistencyCheck方法的具体用法?PHP DevblocksPlatform::versionConsistencyCheck怎么用?PHP DevblocksPlatform::versionConsistencyCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::versionConsistencyCheck方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
function handleRequest(DevblocksHttpRequest $request)
{
@set_time_limit(0);
// no timelimit (when possible)
DevblocksPlatform::clearCache();
$stack = $request->path;
array_shift($stack);
// update
switch (array_shift($stack)) {
case 'locked':
if (!DevblocksPlatform::versionConsistencyCheck()) {
$url = DevblocksPlatform::getUrlService();
echo "<h1>PortSensor Portal</h1>";
echo "The application is currently waiting for an administrator to finish upgrading. " . "Please wait a few minutes and then " . sprintf("<a href='%s'>try again</a>.<br><br>", $url->write('c=update&a=locked'));
echo sprintf("If you're an admin you may <a href='%s'>finish the upgrade</a>.", $url->write('c=update'));
} else {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('home')));
}
break;
default:
$path = DEVBLOCKS_PATH . 'tmp' . DIRECTORY_SEPARATOR;
$file = $path . 'psupdate_lock';
if (!file_exists($file) || @filectime($file) + 600 < time()) {
// 10 min lock
touch($file);
// $settings = CerberusSettings::getInstance();
// $authorized_ips_str = $settings->get(CerberusSettings::AUTHORIZED_IPS);
// $authorized_ips = CerberusApplication::parseCrlfString($authorized_ips_str);
//
// $authorized_ip_defaults = CerberusApplication::parseCsvString(AUTHORIZED_IPS_DEFAULTS);
// $authorized_ips = array_merge($authorized_ips, $authorized_ip_defaults);
//
// $pass = false;
// foreach ($authorized_ips as $ip)
// {
// if(substr($ip,0,strlen($ip)) == substr($_SERVER['REMOTE_ADDR'],0,strlen($ip)))
// { $pass=true; break; }
// }
$pass = true;
if (!$pass) {
echo 'Your IP address (' . $_SERVER['REMOTE_ADDR'] . ') is not authorized to update this helpdesk.';
return;
}
//echo "Running plugin patches...<br>";
if (DevblocksPlatform::runPluginPatches()) {
@unlink($file);
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('home')));
} else {
@unlink($file);
echo "Failure!";
// [TODO] Needs elaboration
}
break;
} else {
echo "Another administrator is currently running update. Please wait...";
}
}
exit;
}
示例2: handleRequest
function handleRequest(DevblocksHttpRequest $request)
{
@set_time_limit(0);
// no timelimit (when possible)
$translate = DevblocksPlatform::getTranslationService();
$stack = $request->path;
array_shift($stack);
// update
$cache = DevblocksPlatform::getCacheService();
/* @var $cache _DevblocksCacheManager */
switch (array_shift($stack)) {
case 'locked':
if (!DevblocksPlatform::versionConsistencyCheck()) {
$url = DevblocksPlatform::getUrlService();
echo "<h1>Feg - Fax Email Gateway 1.x</h1>";
echo "The application is currently waiting for an administrator to finish upgrading. " . "Please wait a few minutes and then " . sprintf("<a href='%s'>try again</a>.<br><br>", $url->write('c=update&a=locked'));
echo sprintf("If you're an admin you may <a href='%s'>finish the upgrade</a>.", $url->write('c=update'));
} else {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login')));
}
break;
default:
$path = APP_TEMP_PATH . DIRECTORY_SEPARATOR;
$file = $path . 'feg_update_lock';
$settings = DevblocksPlatform::getPluginSettingsService();
$authorized_ips_str = $settings->get('feg.core', FegSettings::AUTHORIZED_IPS);
$authorized_ips = DevblocksPlatform::parseCrlfString($authorized_ips_str);
$authorized_ip_defaults = DevblocksPlatform::parseCsvString(AUTHORIZED_IPS_DEFAULTS);
$authorized_ips = array_merge($authorized_ips, $authorized_ip_defaults);
// Is this IP authorized?
$pass = false;
foreach ($authorized_ips as $ip) {
if (substr($ip, 0, strlen($ip)) == substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip))) {
$pass = true;
break;
}
}
if (!$pass) {
echo vsprintf($translate->_('update.ip_unauthorized'), $_SERVER['REMOTE_ADDR']);
return;
}
// Check requirements
$errors = FegApplication::checkRequirements();
if (!empty($errors)) {
echo $translate->_('update.correct_errors');
echo "<ul style='color:red;'>";
foreach ($errors as $error) {
echo "<li>" . $error . "</li>";
}
echo "</ul>";
exit;
}
try {
// If authorized, lock and attempt update
if (!file_exists($file) || @filectime($file) + 600 < time()) {
// 10 min lock
// Log everybody out since we're touching the database
$session = DevblocksPlatform::getSessionService();
$session->clearAll();
// Lock file
touch($file);
// Recursive patch
FegApplication::update();
// Clean up
@unlink($file);
$cache = DevblocksPlatform::getCacheService();
$cache->save(APP_BUILD, "devblocks_app_build");
// Clear all caches
$cache->clean();
DevblocksPlatform::getClassLoaderService()->destroy();
// Clear compiled templates
$tpl = DevblocksPlatform::getTemplateService();
$tpl->utility->clearCompiledTemplate();
$tpl->cache->clearAll();
// Reload plugin translations
DAO_Translation::reloadPluginStrings();
// Redirect
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login')));
} else {
echo $translate->_('update.locked_another');
}
} catch (Exception $e) {
unlink($file);
die($e->getMessage());
}
}
exit;
}
示例3: getcwd
}
require getcwd() . '/framework.config.php';
require DEVBLOCKS_PATH . 'Devblocks.class.php';
// If this is our first run, redirect to the installer
if ('' == APP_DB_DRIVER || '' == APP_DB_HOST || '' == APP_DB_DATABASE || null == ($db = DevblocksPlatform::getDatabaseService()) || DevblocksPlatform::isDatabaseEmpty()) {
header('Location: ' . dirname($_SERVER['PHP_SELF']) . '/install/index.php');
// [TODO] change this to a meta redirect
exit;
}
require APP_PATH . '/api/Application.class.php';
DevblocksPlatform::init();
DevblocksPlatform::setExtensionDelegate('C4_DevblocksExtensionDelegate');
// Request
$request = DevblocksPlatform::readRequest();
// Patches (if not on the patch page)
if (@0 != strcasecmp(@$request->path[0], "update") && !DevblocksPlatform::versionConsistencyCheck()) {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('update', 'locked')));
}
//DevblocksPlatform::readPlugins();
$session = DevblocksPlatform::getSessionService();
// Localization
DevblocksPlatform::setLocale(isset($_SESSION['locale']) && !empty($_SESSION['locale']) ? $_SESSION['locale'] : 'en_US');
if (isset($_SESSION['timezone'])) {
@date_default_timezone_set($_SESSION['timezone']);
}
// Initialize Logging
if (method_exists('DevblocksPlatform', 'getConsoleLog')) {
$timeout = ini_get('max_execution_time');
$logger = DevblocksPlatform::getConsoleLog();
$logger->info("[Devblocks] ** Platform starting (" . date("r") . ") **");
$logger->info('[Devblocks] Time Limit: ' . ($timeout ? $timeout : 'unlimited') . " secs");
示例4: handleRequest
function handleRequest(DevblocksHttpRequest $request)
{
@set_time_limit(0);
// no timelimit (when possible)
$translate = DevblocksPlatform::getTranslationService();
$stack = $request->path;
array_shift($stack);
// update
$cache = DevblocksPlatform::getCacheService();
/* @var $cache _DevblocksCacheManager */
$settings = DevblocksPlatform::getPluginSettingsService();
switch (array_shift($stack)) {
case 'locked':
if (!DevblocksPlatform::versionConsistencyCheck()) {
$url = DevblocksPlatform::getUrlService();
echo "<h1>Cerberus Helpdesk 5.x</h1>";
echo "The helpdesk is currently waiting for an administrator to finish upgrading. " . "Please wait a few minutes and then " . sprintf("<a href='%s'>try again</a>.<br><br>", $url->write('c=update&a=locked'));
echo sprintf("If you're an admin you may <a href='%s'>finish the upgrade</a>.", $url->write('c=update'));
} else {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login')));
}
break;
default:
$path = APP_TEMP_PATH . DIRECTORY_SEPARATOR;
$file = $path . 'c4update_lock';
$authorized_ips_str = $settings->get('cerberusweb.core', CerberusSettings::AUTHORIZED_IPS);
$authorized_ips = DevblocksPlatform::parseCrlfString($authorized_ips_str);
$authorized_ip_defaults = DevblocksPlatform::parseCsvString(AUTHORIZED_IPS_DEFAULTS);
$authorized_ips = array_merge($authorized_ips, $authorized_ip_defaults);
// Is this IP authorized?
$pass = false;
foreach ($authorized_ips as $ip) {
if (substr($ip, 0, strlen($ip)) == substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip))) {
$pass = true;
break;
}
}
if (!$pass) {
echo vsprintf($translate->_('update.ip_unauthorized'), $_SERVER['REMOTE_ADDR']);
return;
}
// Check requirements
$errors = CerberusApplication::checkRequirements();
if (!empty($errors)) {
echo $translate->_('update.correct_errors');
echo "<ul style='color:red;'>";
foreach ($errors as $error) {
echo "<li>" . $error . "</li>";
}
echo "</ul>";
exit;
}
// If authorized, lock and attempt update
if (!file_exists($file) || @filectime($file) + 600 < time()) {
// 10 min lock
touch($file);
//echo "Running plugin patches...<br>";
if (DevblocksPlatform::runPluginPatches('core.patches')) {
@unlink($file);
// [JAS]: Clear all caches
$cache->clean();
DevblocksPlatform::getClassLoaderService()->destroy();
// Clear compiled templates
$tpl = DevblocksPlatform::getTemplateService();
$tpl->clear_compiled_tpl();
// Reload plugin translations
DAO_Translation::reloadPluginStrings();
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login')));
} else {
@unlink($file);
echo "Failure!";
// [TODO] Needs elaboration
}
break;
} else {
echo $translate->_('update.locked_another');
}
}
exit;
}