本文整理汇总了PHP中CRM_Upgrade_Form::getUpgradeVersions方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Upgrade_Form::getUpgradeVersions方法的具体用法?PHP CRM_Upgrade_Form::getUpgradeVersions怎么用?PHP CRM_Upgrade_Form::getUpgradeVersions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Upgrade_Form
的用法示例。
在下文中一共展示了CRM_Upgrade_Form::getUpgradeVersions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Perform an upgrade without using the web-frontend
*
* @param bool $enablePrint
*
* @throws Exception
* @return array, with keys:
* - message: string, HTML-ish blob
*/
public function run($enablePrint = TRUE)
{
// lets get around the time limit issue if possible for upgrades
if (!ini_get('safe_mode')) {
set_time_limit(0);
}
$upgrade = new CRM_Upgrade_Form();
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
if ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
throw new Exception($error);
}
// Disable our SQL triggers
CRM_Core_DAO::dropTriggers();
// CRM-11156
$preUpgradeMessage = NULL;
$upgrade->setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
$postUpgradeMessageFile = CRM_Utils_File::tempnam('civicrm-post-upgrade');
$queueRunner = new CRM_Queue_Runner(array('title' => ts('CiviCRM Upgrade Tasks'), 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $postUpgradeMessageFile)));
$queueResult = $queueRunner->runAll();
if ($queueResult !== TRUE) {
$errorMessage = CRM_Core_Error::formatTextException($queueResult['exception']);
CRM_Core_Error::debug_log_message($errorMessage);
if ($enablePrint) {
print $errorMessage;
}
throw $queueResult['exception'];
// FIXME test
}
CRM_Upgrade_Form::doFinish();
$message = file_get_contents($postUpgradeMessageFile);
return array('latestVer' => $latestVer, 'message' => $message, 'text' => CRM_Utils_String::htmlToText($message));
}
示例2: runFinish
/**
* Display any final messages, clear caches, etc
*/
public function runFinish()
{
$upgrade = new CRM_Upgrade_Form();
$template = CRM_Core_Smarty::singleton();
// If we're redirected from queue-runner, then isUpgradePending=true.
// If user then reloads the finish page, the isUpgradePending will be unset. (Because the session has been cleared.)
if ($this->get('isUpgradePending')) {
// TODO: Use structured message store
$postUpgradeMessage = file_get_contents($this->get('postUpgradeMessageFile'));
// This destroys $session, so do it after get('postUpgradeMessageFile')
CRM_Upgrade_Form::doFinish();
} else {
$postUpgradeMessage = '';
// Session was destroyed! Can't recover messages.
}
// do a version check - after doFinish() sets the final version
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
if ($error = $upgrade->checkCurrentVersion($currentVer, $latestVer)) {
CRM_Core_Error::fatal($error);
}
$template->assign('message', $postUpgradeMessage);
$template->assign('upgraded', TRUE);
$template->assign('sid', CRM_Utils_System::getSiteID());
// Render page header
if (!defined('CIVICRM_UF_HEAD') && ($region = CRM_Core_Region::instance('html-header', FALSE))) {
CRM_Utils_System::addHTMLHead($region->render(''));
}
$content = $template->fetch('CRM/common/success.tpl');
echo CRM_Utils_System::theme($content, $this->_print, TRUE);
}
示例3: doFinish
public static function doFinish()
{
$upgrade = new CRM_Upgrade_Form();
list($ignore, $latestVer) = $upgrade->getUpgradeVersions();
// Seems extraneous in context, but we'll preserve old behavior
$upgrade->setVersion($latestVer);
// lets rebuild the config array in case we've made a few changes in the
// code base
// this also helps us always store the latest version of civi in the DB
$params = array();
CRM_Core_BAO_ConfigSetting::add($params);
// CRM-12804 comment-51411 : add any missing settings
// at the end of upgrade
CRM_Core_BAO_Setting::updateSettingsFromMetaData();
// cleanup caches CRM-8739
$config = CRM_Core_Config::singleton();
$config->cleanupCaches(1);
// Rebuild all triggers and re-enable logging if needed
$logging = new CRM_Logging_Schema();
$logging->fixSchemaDifferences();
//CRM-16257 update Config.IDS.ini might be an old copy
CRM_Core_IDS::createConfigFile(TRUE);
}
示例4: doFinish
public static function doFinish()
{
$upgrade = new CRM_Upgrade_Form();
list($ignore, $latestVer) = $upgrade->getUpgradeVersions();
// Seems extraneous in context, but we'll preserve old behavior
$upgrade->setVersion($latestVer);
// Clear cached metadata.
Civi::service('settings_manager')->flush();
// cleanup caches CRM-8739
$config = CRM_Core_Config::singleton();
$config->cleanupCaches(1);
// Rebuild all triggers and re-enable logging if needed
$logging = new CRM_Logging_Schema();
$logging->fixSchemaDifferences();
//CRM-16257 update Config.IDS.ini might be an old copy
CRM_Core_IDS::createConfigFile(TRUE);
}
示例5: doFinish
static function doFinish()
{
$upgrade = new CRM_Upgrade_Form();
list($ignore, $latestVer) = $upgrade->getUpgradeVersions();
// Seems extraneous in context, but we'll preserve old behavior
$upgrade->setVersion($latestVer);
// cleanup caches CRM-8739
$config = CRM_Core_Config::singleton();
$config->cleanupCaches(1, FALSE);
}
示例6: runFinish
/**
* Display any final messages, clear caches, etc
*/
function runFinish()
{
$upgrade = new CRM_Upgrade_Form();
$template = CRM_Core_Smarty::singleton();
// TODO: Use structured message store
$postUpgradeMessage = file_get_contents($this->get('postUpgradeMessageFile'));
// This destroys $session, so do it after ge('postUpgradeMessageFile')
CRM_Upgrade_Form::doFinish();
// do a version check - after doFinish() sets the final version
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
if ($error = $upgrade->checkCurrentVersion($currentVer, $latestVer)) {
CRM_Core_Error::fatal($error);
}
$template->assign('message', $postUpgradeMessage);
$template->assign('upgraded', TRUE);
$content = $template->fetch('CRM/common/success.tpl');
echo CRM_Utils_System::theme('page', $content, TRUE, $this->_print, FALSE, TRUE);
}