本文整理汇总了PHP中CRM_Upgrade_Form::checkUpgradeableVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Upgrade_Form::checkUpgradeableVersion方法的具体用法?PHP CRM_Upgrade_Form::checkUpgradeableVersion怎么用?PHP CRM_Upgrade_Form::checkUpgradeableVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Upgrade_Form
的用法示例。
在下文中一共展示了CRM_Upgrade_Form::checkUpgradeableVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: runBegin
/**
* Begin the upgrade by building a queue of tasks and redirecting to the queue-runner
*/
public function runBegin()
{
$upgrade = new CRM_Upgrade_Form();
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
if ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
CRM_Core_Error::fatal($error);
}
$config = CRM_Core_Config::singleton();
$postUpgradeMessage = '<span class="bold">' . ts('Congratulations! Your upgrade was successful!') . '</span>';
// lets drop all the triggers here
CRM_Core_DAO::dropTriggers();
$this->set('isUpgradePending', TRUE);
// Persistent message storage across upgrade steps. TODO: Use structured message store
// Note: In clustered deployments, this file must be accessible by all web-workers.
$this->set('postUpgradeMessageFile', CRM_Utils_File::tempnam('civicrm-post-upgrade'));
file_put_contents($this->get('postUpgradeMessageFile'), $postUpgradeMessage);
$queueRunner = new CRM_Queue_Runner(array('title' => ts('CiviCRM Upgrade Tasks'), 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $this->get('postUpgradeMessageFile')), 'isMinimal' => TRUE, 'pathPrefix' => 'civicrm/upgrade/queue', 'onEndUrl' => CRM_Utils_System::url('civicrm/upgrade', 'action=finish', FALSE, NULL, FALSE), 'buttons' => array('retry' => $config->debug, 'skip' => $config->debug)));
$queueRunner->runAllViaWeb();
CRM_Core_Error::fatal(ts('Upgrade failed to redirect'));
}
示例3: runBegin
/**
* Begin the upgrade by building a queue of tasks and redirecting to the queue-runner
*/
function runBegin()
{
$upgrade = new CRM_Upgrade_Form();
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
if ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
CRM_Core_Error::fatal($error);
}
$config = CRM_Core_Config::singleton();
// This could be removed in later rev
if ($currentVer == '2.1.6') {
// also cleanup the templates_c directory
$config->cleanupCaches();
}
// end of hack
$postUpgradeMessage = ts('CiviCRM upgrade was successful.');
// Persistent message storage across upgrade steps. TODO: Use structured message store
// Note: In clustered deployments, this file must be accessible by all web-workers.
$this->set('postUpgradeMessageFile', CRM_Utils_File::tempnam('civicrm-post-upgrade'));
file_put_contents($this->get('postUpgradeMessageFile'), $postUpgradeMessage);
$queueRunner = new CRM_Queue_Runner(array('title' => ts('CiviCRM Upgrade Tasks'), 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $this->get('postUpgradeMessageFile')), 'isMinimal' => TRUE, 'pathPrefix' => 'civicrm/upgrade/queue', 'onEndUrl' => CRM_Utils_System::url('civicrm/upgrade', 'action=finish', FALSE, NULL, FALSE), 'buttons' => array('retry' => $config->debug, 'skip' => $config->debug)));
$queueRunner->runAllViaWeb();
CRM_Core_Error::fatal(ts('Upgrade failed to redirect'));
}