本文整理匯總了PHP中CRM_Utils_System::isDBVersionValid方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Utils_System::isDBVersionValid方法的具體用法?PHP CRM_Utils_System::isDBVersionValid怎麽用?PHP CRM_Utils_System::isDBVersionValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::isDBVersionValid方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
/**
* @return string
*/
function run()
{
$errorMessage = '';
// ensure that all CiviCRM tables are InnoDB, else abort
// this is not a very fast operation, so we do it randomly 10% of the times
// but we do it for most / all tables
// http://bugs.mysql.com/bug.php?id=43664
if (rand(1, 10) == 3 && CRM_Core_DAO::isDBMyISAM(150)) {
$errorMessage = ts('Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.');
CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert");
}
if (!CRM_Utils_System::isDBVersionValid($errorMessage)) {
CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert", array('expires' => 0));
}
$groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), 'Communications' => ts('Communications'), 'Localization' => ts('Localization'), 'Users and Permissions' => ts('Users and Permissions'), 'System Settings' => ts('System Settings'));
$config = CRM_Core_Config::singleton();
if (in_array('CiviContribute', $config->enableComponents)) {
$groups['CiviContribute'] = ts('CiviContribute');
}
if (in_array('CiviMember', $config->enableComponents)) {
$groups['CiviMember'] = ts('CiviMember');
}
if (in_array('CiviEvent', $config->enableComponents)) {
$groups['CiviEvent'] = ts('CiviEvent');
}
if (in_array('CiviMail', $config->enableComponents)) {
$groups['CiviMail'] = ts('CiviMail');
}
if (in_array('CiviCase', $config->enableComponents)) {
$groups['CiviCase'] = ts('CiviCase');
}
if (in_array('CiviReport', $config->enableComponents)) {
$groups['CiviReport'] = ts('CiviReport');
}
if (in_array('CiviCampaign', $config->enableComponents)) {
$groups['CiviCampaign'] = ts('CiviCampaign');
}
$values = CRM_Core_Menu::getAdminLinks();
$this->_showHide = new CRM_Core_ShowHideBlocks();
foreach ($groups as $group => $title) {
$groupId = str_replace(' ', '_', $group);
$this->_showHide->addShow("id_{$groupId}_show");
$this->_showHide->addHide("id_{$groupId}");
$v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
if (isset($values[$group])) {
$adminPanel[$groupId] = $values[$group];
$adminPanel[$groupId]['show'] = $v['show'];
$adminPanel[$groupId]['hide'] = $v['hide'];
$adminPanel[$groupId]['title'] = $title;
} else {
$adminPanel[$groupId] = array();
$adminPanel[$groupId]['show'] = '';
$adminPanel[$groupId]['hide'] = '';
$adminPanel[$groupId]['title'] = $title;
}
}
$this->assign('adminPanel', $adminPanel);
$this->_showHide->addToTemplate();
return parent::run();
}
示例2: run
function run()
{
// ensure that all CiviCRM tables are InnoDB, else abort
if (CRM_Core_DAO::isDBMyISAM()) {
$errorMessage = 'Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues. This will be a fatal error in CiviCRM v2.1.';
require_once 'CRM/Core/Session.php';
CRM_Core_Session::setStatus($errorMessage);
}
if (!CRM_Utils_System::isDBVersionValid($errorMessage)) {
CRM_Core_Session::setStatus($errorMessage);
}
$groups = array('Customize' => ts('Customize'), 'Configure' => ts('Configure'), 'Manage' => ts('Manage'), 'Option Lists' => ts('Option Lists'));
$config = CRM_Core_Config::singleton();
if (in_array("CiviContribute", $config->enableComponents)) {
$groups['CiviContribute'] = ts('CiviContribute');
}
if (in_array("CiviMember", $config->enableComponents)) {
$groups['CiviMember'] = ts('CiviMember');
}
if (in_array("CiviEvent", $config->enableComponents)) {
$groups['CiviEvent'] = ts('CiviEvent');
}
if (in_array("CiviMail", $config->enableComponents)) {
$groups['CiviMail'] = ts('CiviMail');
}
if (in_array("CiviCase", $config->enableComponents)) {
$groups['CiviCase'] = ts('CiviCase');
}
if (in_array("CiviReport", $config->enableComponents)) {
$groups['CiviReport'] = ts('CiviReport');
}
if (in_array("CiviCampaign", $config->enableComponents)) {
$groups['CiviCampaign'] = ts('CiviCampaign');
}
require_once 'CRM/Core/Menu.php';
$values =& CRM_Core_Menu::getAdminLinks();
require_once 'CRM/Core/ShowHideBlocks.php';
$this->_showHide = new CRM_Core_ShowHideBlocks();
foreach ($groups as $group => $title) {
$this->_showHide->addShow("id_{$group}_show");
$this->_showHide->addHide("id_{$group}");
$v = CRM_Core_ShowHideBlocks::links($this, $group, '', '', false);
$adminPanel[$group] = $values[$group];
$adminPanel[$group]['show'] = $v['show'];
$adminPanel[$group]['hide'] = $v['hide'];
$adminPanel[$group]['title'] = $title;
}
require_once 'CRM/Utils/VersionCheck.php';
$versionCheck =& CRM_Utils_VersionCheck::singleton();
$this->assign('newVersion', $versionCheck->newerVersion());
$this->assign('localVersion', $versionCheck->localVersion);
$this->assign('adminPanel', $adminPanel);
$this->_showHide->addToTemplate();
return parent::run();
}