本文整理汇总了PHP中CRM_Upgrade_Form::checkVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Upgrade_Form::checkVersion方法的具体用法?PHP CRM_Upgrade_Form::checkVersion怎么用?PHP CRM_Upgrade_Form::checkVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Upgrade_Form
的用法示例。
在下文中一共展示了CRM_Upgrade_Form::checkVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
$upgrade = new CRM_Upgrade_Form();
$message = ts('CiviCRM upgrade successful');
if ($upgrade->checkVersion($upgrade->latestVersion)) {
$message = ts('Your database has already been upgraded to CiviCRM %1', array(1 => $upgrade->latestVersion));
} elseif ($upgrade->checkVersion('2.1.2') || $upgrade->checkVersion('2.1.3') || $upgrade->checkVersion('2.1.4') || $upgrade->checkVersion('2.1.5')) {
// do nothing, db version is changed for all upgrades
} elseif ($upgrade->checkVersion('2.1.0') || $upgrade->checkVersion('2.1') || $upgrade->checkVersion('2.1.1')) {
// 2.1 to 2.1.2
$this->runTwoOneTwo();
} else {
// 2.0 to 2.1
for ($i = 1; $i <= 4; $i++) {
$this->runForm($i);
}
// 2.1 to 2.1.2
$this->runTwoOneTwo();
}
// just change the ver in the db, since nothing to upgrade
$upgrade->setVersion($upgrade->latestVersion);
// also cleanup the templates_c directory
$config = CRM_Core_Config::singleton();
$config->cleanup(1);
$template = CRM_Core_Smarty::singleton();
$template->assign('message', $message);
$template->assign('pageTitle', ts('Upgrade CiviCRM to Version %1', array(1 => $upgrade->latestVersion)));
$template->assign('menuRebuildURL', CRM_Utils_System::url('civicrm/menu/rebuild', 'reset=1'));
$contents = $template->fetch('CRM/common/success.tpl');
echo $contents;
}