本文整理汇总了PHP中CRM_Upgrade_Form::setVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Upgrade_Form::setVersion方法的具体用法?PHP CRM_Upgrade_Form::setVersion怎么用?PHP CRM_Upgrade_Form::setVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Upgrade_Form
的用法示例。
在下文中一共展示了CRM_Upgrade_Form::setVersion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: run
//.........这里部分代码省略.........
$customContactSubTypeEdit = $config->customTemplateDir . "CRM/Contact/Form/Edit/" . $subTypeName . ".tpl";
$customContactSubTypeView = $config->customTemplateDir . "CRM/Contact/Page/View/" . $subTypeName . ".tpl";
if (file_exists($customContactSubTypeEdit) || file_exists($customContactSubTypeView)) {
$subTypeTemplates[$subTypeName] = $subTypeName;
}
}
}
foreach ($subTypes as $key => $subTypeName) {
$customContactSubTypeEdit = $config->templateDir . "CRM/Contact/Form/Edit/" . $subTypeName . ".tpl";
$customContactSubTypeView = $config->templateDir . "CRM/Contact/Page/View/" . $subTypeName . ".tpl";
if (file_exists($customContactSubTypeEdit) || file_exists($customContactSubTypeView)) {
$subTypeTemplates[$subTypeName] = $subTypeName;
}
}
if (!empty($subTypeTemplates)) {
$subTypeTemplates = implode(',', $subTypeTemplates);
$message .= '<br />' . ts('You are using custom template for contact subtypes: %1.', array(1 => $subTypeTemplates)) . '<br />' . ts('You need to move these subtype templates to the SubType directory in %1 and %2 respectively.', array(1 => 'CRM/Contact/Form/Edit', 2 => 'CRM/Contact/Page/View'));
}
}
} else {
if ($latestVer == '3.2.beta4') {
$statuses = array('New', 'Current', 'Grace', 'Expired', 'Pending', 'Cancelled', 'Deceased');
$sql = "\nSELECT count( id ) as statusCount \n FROM civicrm_membership_status \n WHERE name IN ( '" . implode("' , '", $statuses) . "' ) ";
$count = CRM_Core_DAO::singleValueQuery($sql);
if ($count < count($statuses)) {
$message .= '<br />' . ts("One or more Membership Status Rules was disabled during the upgrade because it did not match a recognized status name. if custom membership status rules were added to this site - review the disabled statuses and re-enable any that are still needed (Administer > CiviMember > Membership Status Rules).");
}
}
}
}
$template->assign('currentVersion', $currentVer);
$template->assign('newVersion', $latestVer);
$template->assign('upgradeTitle', ts('Upgrade CiviCRM from v %1 To v %2', array(1 => $currentVer, 2 => $latestVer)));
$template->assign('upgraded', false);
if (CRM_Utils_Array::value('upgrade', $_POST)) {
$revisions = $upgrade->getRevisionSequence();
foreach ($revisions as $rev) {
// proceed only if $currentVer < $rev
if (version_compare($currentVer, $rev) < 0) {
// as soon as we start doing anything we append ".upgrade" to version.
// this also helps detect any partial upgrade issues
$upgrade->setVersion($rev . '.upgrade');
$phpFunctionName = 'upgrade_' . str_replace('.', '_', $rev);
// follow old upgrade process for all version
// below 3.2.alpha1
if (version_compare($rev, '3.2.alpha1') < 0) {
if (is_callable(array($this, $phpFunctionName))) {
eval("\$this->{$phpFunctionName}('{$rev}');");
} else {
$upgrade->processSQL($rev);
}
} else {
// new upgrade process from version
// 3.2.alpha1
$versionObject = $upgrade->incrementalPhpObject($rev);
// predb check for major release.
if ($upgrade->checkVersionRelease($rev, 'alpha1')) {
if (!is_callable(array($versionObject, 'verifyPreDBstate'))) {
CRM_Core_Error::fatal("verifyPreDBstate method was not found for {$rev}");
}
$error = null;
if (!$versionObject->verifyPreDBstate($error)) {
if (!isset($error)) {
$error = "post-condition failed for current upgrade for {$rev}";
}
CRM_Core_Error::fatal($error);
}
}
if (is_callable(array($versionObject, $phpFunctionName))) {
$versionObject->{$phpFunctionName}($rev);
} else {
$upgrade->processSQL($rev);
}
}
// after an successful intermediate upgrade, set the complete version
$upgrade->setVersion($rev);
}
}
$upgrade->setVersion($latestVer);
$template->assign('upgraded', true);
// also cleanup the templates_c directory
$config = CRM_Core_Config::singleton();
$config->cleanup(1, false);
// clear db caching
$config->clearDBCache();
// clear temporary tables
$config->clearTempTables();
// clean the session. Note: In case of standalone this makes the user logout.
// So skip this step for standalone.
if ($config->userFramework !== 'Standalone') {
$session = CRM_Core_Session::singleton();
$session->reset(2);
}
}
}
}
$template->assign('message', $message);
$content = $template->fetch('CRM/common/success.tpl');
echo CRM_Utils_System::theme('page', $content, true, $this->_print, false, 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);
// 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);
}
示例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);
// 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);
}
示例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);
}