当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_Domain::version方法代码示例

本文整理汇总了PHP中CRM_Core_BAO_Domain::version方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Domain::version方法的具体用法?PHP CRM_Core_BAO_Domain::version怎么用?PHP CRM_Core_BAO_Domain::version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_BAO_Domain的用法示例。


在下文中一共展示了CRM_Core_BAO_Domain::version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 public function preProcess()
 {
     $version = CRM_Core_BAO_Domain::version();
     if (version_compare($version, '4.5', '<')) {
         $this->use_old_contact_ref_fields = true;
     }
     parent::preProcess();
     // TODO: Change the autogenerated stub
 }
开发者ID:elcapo,项目名称:org.civicoop.civirules,代码行数:9,代码来源:Activity.php

示例2: formRule

 public static function formRule($params)
 {
     $currentVer = CRM_Core_BAO_Domain::version(TRUE);
     $errors = array();
     if (version_compare($currentVer, '4.4') < 0) {
         $errors['version_error'] = " You need to upgrade to version 4.4 or above to work with extension Mailchimp";
     }
     return empty($errors) ? TRUE : $errors;
 }
开发者ID:sunilpawar,项目名称:uk.co.vedaconsulting.mailchimp,代码行数:9,代码来源:Setting.php

示例3: invoke

 private function invoke($fnSuffix, $numParams, &$arg1 = null, &$arg2 = null, &$arg3 = null, &$arg4 = null, &$arg5 = null)
 {
     $hook = CRM_Utils_Hook::singleton();
     $civiVersion = CRM_Core_BAO_Domain::version();
     if (version_compare('4.4', $civiVersion, '<=')) {
         //in CiviCRM 4.4 the invoke function has 5 arguments maximum
         return $hook->invoke($numParams, $arg1, $arg2, $arg3, $arg4, $arg5, $fnSuffix);
     }
     //in CiviCRM 4.5 and later the invoke function has 6 arguments
     return $hook->invoke($numParams, $arg1, $arg2, $arg3, $arg4, $arg5, null, $fnSuffix);
 }
开发者ID:alejandro-ixiam,项目名称:org.civicoop.civirules,代码行数:11,代码来源:HookInvoker.php

示例4: run

 function run()
 {
     // lets get around the time limit issue if possible for upgrades
     if (!ini_get('safe_mode')) {
         set_time_limit(0);
     }
     $latestVer = CRM_Utils_System::version();
     $currentVer = CRM_Core_BAO_Domain::version();
     if (!$currentVer) {
         CRM_Core_Error::fatal(ts('Version information missing in civicrm database.'));
     } else {
         if (stripos($currentVer, 'upgrade')) {
             CRM_Core_Error::fatal(ts('Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again.'));
         }
     }
     if (!$latestVer) {
         CRM_Core_Error::fatal(ts('Version information missing in civicrm codebase.'));
     }
     // hack to make past ver compatible /w new incremental upgrade process
     $convertVer = array('2.1' => '2.1.0', '2.2' => '2.2.alpha1', '2.2.alph' => '2.2.alpha3', '3.1.0' => '3.1.1');
     if (isset($convertVer[$currentVer])) {
         $currentVer = $convertVer[$currentVer];
     }
     // since version is suppose to be in valid format at this point, especially after conversion ($convertVer),
     // lets do a pattern check -
     if (!CRM_Utils_System::isVersionFormatValid($currentVer)) {
         CRM_Core_Error::fatal(ts('Database is marked with invalid version format. You may want to investigate this before you proceed further.'));
     }
     // This could be removed in later rev
     if ($currentVer == '2.1.6') {
         $config =& CRM_Core_Config::singleton();
         // also cleanup the templates_c directory
         $config->cleanup(1, false);
         if ($config->userFramework !== 'Standalone') {
             // clean the session
             $session =& CRM_Core_Session::singleton();
             $session->reset(2);
         }
     }
     // end of hack
     CRM_Utils_System::setTitle(ts('Upgrade CiviCRM to Version %1', array(1 => $latestVer)));
     $upgrade =& new CRM_Upgrade_Form();
     $template =& CRM_Core_Smarty::singleton();
     $template->assign('pageTitle', ts('Upgrade CiviCRM to Version %1', array(1 => $latestVer)));
     $template->assign('menuRebuildURL', CRM_Utils_System::url('civicrm/menu/rebuild', 'reset=1'));
     $template->assign('cancelURL', CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
     if (version_compare($currentVer, $latestVer) > 0) {
         // DB version number is higher than codebase being upgraded to. This is unexpected condition-fatal error.
         $dbToolsLink = CRM_Utils_System::docURL2("Database Troubleshooting Tools", true);
         $error = ts('Your database is marked with an unexpected version number: %1. The automated upgrade to version %2 can not be run - and the %2 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. The database tools utility at %3 may be helpful. You may want to revert to the codebase you were using prior to beginning this upgrade until you resolve this problem.', array(1 => $currentVer, 2 => $latestVer, 3 => $dbToolsLink));
         CRM_Core_Error::fatal($error);
     } else {
         if (version_compare($currentVer, $latestVer) == 0) {
             $message = ts('Your database has already been upgraded to CiviCRM %1', array(1 => $latestVer));
             $template->assign('upgraded', true);
         } else {
             $message = ts('CiviCRM upgrade was successful.');
             $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);
                         if (is_callable(array($this, $phpFunctionName))) {
                             eval("\$this->{$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();
                 // 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);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:99,代码来源:Upgrade.php

示例5: postProcess

 /**
  * Process the form submission.
  */
 function postProcess()
 {
     $formValues = $this->exportValues();
     $buttonName = $this->controller->getButtonName();
     if ($buttonName == $this->_testButtonName) {
         $session = CRM_Core_Session::singleton();
         $userID = $session->get('userID');
         list($toDisplayName, $toEmail, $toDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($userID);
         //get the default domain email address.CRM-4250
         list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail();
         if (!$domainEmailAddress || $domainEmailAddress == 'info@EXAMPLE.ORG') {
             $fixUrl = CRM_Utils_System::url("civicrm/admin/domain", 'action=update&reset=1');
             CRM_Core_Error::fatal(ts('The site administrator needs to enter a valid \'FROM Email Address\' in <a href="%1">Administer CiviCRM &raquo; Communications &raquo; FROM Email Addresses</a>. The email address used may need to be a valid mail account with your email service provider.', array(1 => $fixUrl)));
         }
         if (!$toEmail) {
             CRM_Core_Error::statusBounce(ts('Cannot send a test email because your user record does not have a valid email address.'));
         }
         if (!trim($toDisplayName)) {
             $toDisplayName = $toEmail;
         }
         $testMailStatusMsg = ts('Sending test email. FROM: %1 TO: %2.<br />', array(1 => $domainEmailAddress, 2 => $toEmail));
         $params = array();
         $message = "SMTP settings are correct.";
         $params['host'] = $formValues['smtpServer'];
         $params['port'] = $formValues['smtpPort'];
         if ($formValues['smtpAuth']) {
             $params['username'] = $formValues['smtpUsername'];
             $params['password'] = $formValues['smtpPassword'];
             $params['auth'] = TRUE;
         } else {
             $params['auth'] = FALSE;
         }
         // set the localhost value, CRM-3153, CRM-9332
         $params['localhost'] = $_SERVER['SERVER_NAME'];
         // also set the timeout value, lets set it to 30 seconds
         // CRM-7510, CRM-9332
         $params['timeout'] = 30;
         $mailerName = 'smtp';
         $headers = array('From' => '"' . $domainEmailName . '" <' . $domainEmailAddress . '>', 'To' => '"' . $toDisplayName . '"' . "<{$toEmail}>", 'Subject' => "Test for SMTP settings");
         $mailer = Mail::factory($mailerName, $params);
         $config = CRM_Core_Config::singleton();
         if (property_exists($config, 'civiVersion')) {
             $civiVersion = $config->civiVersion;
         } else {
             $civiVersion = CRM_Core_BAO_Domain::version();
         }
         if (version_compare('4.5alpha1', $civiVersion) > 0) {
             CRM_Core_Error::ignoreException();
         } else {
             $errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
         }
         $result = $mailer->send($toEmail, $headers, $message);
         if (version_compare('4.5alpha1', $civiVersion) > 0) {
             CRM_Core_Error::setCallback();
         } else {
             unset($errorScope);
         }
         if (!is_a($result, 'PEAR_Error')) {
             CRM_Core_Session::setStatus($testMailStatusMsg . ts('Your %1 settings are correct. A test email has been sent to your email address.', array(1 => strtoupper($mailerName))), ts("Mail Sent"), "success");
         } else {
             $message = CRM_Utils_Mail::errorMessage($mailer, $result);
             CRM_Core_Session::setStatus($testMailStatusMsg . ts('Oops. Your %1 settings are incorrect. No test mail has been sent.', array(1 => strtoupper($mailerName))) . $message, ts("Mail Not Sent"), "error");
         }
     }
     // if password is present, encrypt it
     if (!empty($formValues['smtpPassword'])) {
         $formValues['smtpPassword'] = CRM_Utils_Crypt::encrypt($formValues['smtpPassword']);
     }
     CRM_Core_BAO_Setting::setItem($formValues, CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mandrill_smtp_settings');
 }
开发者ID:vakeesan26,项目名称:biz.jmaconsulting.mte,代码行数:73,代码来源:MandrillSmtpSetting.php

示例6: isDBVersionValid

 static function isDBVersionValid(&$errorMessage)
 {
     require_once 'CRM/Core/BAO/Domain.php';
     $dbVersion = CRM_Core_BAO_Domain::version();
     if (!$dbVersion) {
         // if db.ver missing
         $errorMessage = ts('Version information found to be missing in database. You will need to determine the correct version corresponding to your current database state.');
         return false;
     } else {
         if (!CRM_Utils_System::isVersionFormatValid($dbVersion)) {
             $errorMessage = ts('Database is marked with invalid version format. You may want to investigate this before you proceed further.');
             return false;
         } else {
             if (stripos($dbVersion, 'upgrade')) {
                 // if db.ver indicates a partially upgraded db
                 $upgradeUrl = CRM_Utils_System::url("civicrm/upgrade", "reset=1");
                 $errorMessage = ts('Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the <a href=\'%1\'>upgrade process</a> again.', array(1 => $upgradeUrl));
                 return false;
             } else {
                 $codeVersion = CRM_Utils_System::version();
                 // if db.ver < code.ver, time to upgrade
                 if (version_compare($dbVersion, $codeVersion) < 0) {
                     $upgradeUrl = CRM_Utils_System::url("civicrm/upgrade", "reset=1");
                     $errorMessage = ts('New codebase version detected. You might want to visit <a href=\'%1\'>upgrade screen</a> to upgrade the database.', array(1 => $upgradeUrl));
                     return false;
                 }
                 // if db.ver > code.ver, sth really wrong
                 if (version_compare($dbVersion, $codeVersion) > 0) {
                     $errorMessage = ts('Your database is marked with an unexpected version number: %1. The v%2 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase you were using until you resolve this problem.', array(1 => $dbVersion, 2 => $codeVersion));
                     $errorMessage .= "<p>" . ts('OR if this is an svn install, you might want to fix version.txt file.') . "</p>";
                     return false;
                 }
             }
         }
     }
     // FIXME: there should be another check to make sure version is in valid format - X.Y.alpha_num
     return true;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:38,代码来源:System.php

示例7: triggerInfo

 static function triggerInfo(&$info, $tableName = NULL)
 {
     // get the current supported locales
     $domain = new CRM_Core_DAO_Domain();
     $domain->find(TRUE);
     if (empty($domain->locales)) {
         return;
     }
     $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
     $locale = array_pop($locales);
     // CRM-10027
     if (count($locales) == 0) {
         return;
     }
     $currentVer = CRM_Core_BAO_Domain::version(TRUE);
     if ($currentVer && CRM_Core_Config::isUpgradeMode()) {
         // take exact version so that proper schema structure file in invoked
         $latest = self::getLatestSchema($currentVer);
         require_once "CRM/Core/I18n/SchemaStructure_{$latest}.php";
         $class = "CRM_Core_I18n_SchemaStructure_{$latest}";
     } else {
         $class = 'CRM_Core_I18n_SchemaStructure';
     }
     $columns =& $class::columns();
     foreach ($columns as $table => $hash) {
         if ($tableName && $tableName != $table) {
             continue;
         }
         $trigger = array();
         foreach ($hash as $column => $_) {
             $trigger[] = "IF NEW.{$column}_{$locale} IS NOT NULL THEN";
             foreach ($locales as $old) {
                 $trigger[] = "IF NEW.{$column}_{$old} IS NULL THEN SET NEW.{$column}_{$old} = NEW.{$column}_{$locale}; END IF;";
             }
             foreach ($locales as $old) {
                 $trigger[] = "ELSEIF NEW.{$column}_{$old} IS NOT NULL THEN";
                 foreach (array_merge($locales, array($locale)) as $loc) {
                     if ($loc == $old) {
                         continue;
                     }
                     $trigger[] = "IF NEW.{$column}_{$loc} IS NULL THEN SET NEW.{$column}_{$loc} = NEW.{$column}_{$old}; END IF;";
                 }
             }
             $trigger[] = 'END IF;';
         }
         $sql = implode(' ', $trigger);
         $info[] = array('table' => array($table), 'when' => 'BEFORE', 'event' => array('UPDATE'), 'sql' => $sql);
     }
     // take care of the ON INSERT triggers
     foreach ($columns as $table => $hash) {
         $trigger = array();
         foreach ($hash as $column => $_) {
             $trigger[] = "IF NEW.{$column}_{$locale} IS NOT NULL THEN";
             foreach ($locales as $old) {
                 $trigger[] = "SET NEW.{$column}_{$old} = NEW.{$column}_{$locale};";
             }
             foreach ($locales as $old) {
                 $trigger[] = "ELSEIF NEW.{$column}_{$old} IS NOT NULL THEN";
                 foreach (array_merge($locales, array($locale)) as $loc) {
                     if ($loc == $old) {
                         continue;
                     }
                     $trigger[] = "SET NEW.{$column}_{$loc} = NEW.{$column}_{$old};";
                 }
             }
             $trigger[] = 'END IF;';
         }
         $sql = implode(' ', $trigger);
         $info[] = array('table' => array($table), 'when' => 'BEFORE', 'event' => array('INSERT'), 'sql' => $sql);
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:71,代码来源:Schema.php

示例8: checkDbVersion

 /**
  * Checks if CiviCRM database version is up-to-date
  * @return array
  */
 public function checkDbVersion()
 {
     $messages = array();
     $dbVersion = CRM_Core_BAO_Domain::version();
     $upgradeUrl = CRM_Utils_System::url("civicrm/upgrade", "reset=1");
     if (!$dbVersion) {
         // if db.ver missing
         $messages[] = new CRM_Utils_Check_Message(__FUNCTION__, ts('Version information found to be missing in database. You will need to determine the correct version corresponding to your current database state.'), ts('Database Version Missing'), \Psr\Log\LogLevel::ERROR, 'fa-database');
     } elseif (!CRM_Utils_System::isVersionFormatValid($dbVersion)) {
         $messages[] = new CRM_Utils_Check_Message(__FUNCTION__, ts('Database is marked with invalid version format. You may want to investigate this before you proceed further.'), ts('Database Version Invalid'), \Psr\Log\LogLevel::ERROR, 'fa-database');
     } elseif (stripos($dbVersion, 'upgrade')) {
         // if db.ver indicates a partially upgraded db
         $messages[] = new CRM_Utils_Check_Message(__FUNCTION__, ts('Database check failed - the database looks to have been partially upgraded. You must reload the database with the backup and try the <a href=\'%1\'>upgrade process</a> again.', array(1 => $upgradeUrl)), ts('Database Partially Upgraded'), \Psr\Log\LogLevel::ALERT, 'fa-database');
     } else {
         $codeVersion = CRM_Utils_System::version();
         // if db.ver < code.ver, time to upgrade
         if (version_compare($dbVersion, $codeVersion) < 0) {
             $messages[] = new CRM_Utils_Check_Message(__FUNCTION__, ts('New codebase version detected. You must visit <a href=\'%1\'>upgrade screen</a> to upgrade the database.', array(1 => $upgradeUrl)), ts('Database Upgrade Required'), \Psr\Log\LogLevel::ALERT, 'fa-database');
         }
         // if db.ver > code.ver, sth really wrong
         if (version_compare($dbVersion, $codeVersion) > 0) {
             $messages[] = new CRM_Utils_Check_Message(__FUNCTION__, ts('Your database is marked with an unexpected version number: %1. The v%2 codebase may not be compatible with your database state.
         You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase
         you were using until you resolve this problem.<br/>OR if this is a manual install from git, you might want to fix civicrm-version.php file.', array(1 => $dbVersion, 2 => $codeVersion)), ts('Database In Unexpected Version'), \Psr\Log\LogLevel::ERROR, 'fa-database');
         }
     }
     return $messages;
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:32,代码来源:Env.php

示例9: retrieveDirectoryAndURLPreferences

 static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = FALSE)
 {
     if ($setInConfig) {
         $config = CRM_Core_Config::singleton();
     }
     $isJoomla = defined('CIVICRM_UF') && CIVICRM_UF == 'Joomla' ? TRUE : FALSE;
     if (CRM_Core_Config::isUpgradeMode() && !$isJoomla) {
         $currentVer = CRM_Core_BAO_Domain::version();
         if (version_compare($currentVer, '4.1.alpha1') < 0) {
             return;
         }
     }
     $sql = "\nSELECT name, group_name, value\nFROM   civicrm_setting\nWHERE  ( group_name = %1\nOR       group_name = %2 )\nAND domain_id = %3\n";
     $sqlParams = array(1 => array(self::DIRECTORY_PREFERENCES_NAME, 'String'), 2 => array(self::URL_PREFERENCES_NAME, 'String'), 3 => array(CRM_Core_Config::domainID(), 'Integer'));
     $dao = CRM_Core_DAO::executeQuery($sql, $sqlParams, TRUE, NULL, FALSE, TRUE, TRUE);
     if (is_a($dao, 'DB_Error')) {
         if (CRM_Core_Config::isUpgradeMode()) {
             // seems like this is a 4.0 -> 4.1 upgrade, so we suppress this error and continue
             // hack to set the resource base url so that js/ css etc is loaded correctly
             if ($isJoomla) {
                 $params['userFrameworkResourceURL'] = CRM_Utils_File::addTrailingSlash(CIVICRM_UF_BASEURL, '/') . str_replace('administrator', '', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'userFrameworkResourceURL', 'value', 'name'));
             }
             return;
         } else {
             echo "Fatal DB error, exiting, seems like your schema does not have civicrm_setting table\n";
             exit;
         }
     }
     while ($dao->fetch()) {
         $value = self::getOverride($dao->group_name, $dao->name, NULL);
         if ($value === NULL && $dao->value) {
             $value = unserialize($dao->value);
             if ($dao->group_name == self::DIRECTORY_PREFERENCES_NAME) {
                 $value = CRM_Utils_File::absoluteDirectory($value);
             } else {
                 // CRM-7622: we need to remove the language part
                 $value = CRM_Utils_System::absoluteURL($value, TRUE);
             }
         }
         // CRM-10931, If DB doesn't have any value, carry on with any default value thats already available
         if (!isset($value) && CRM_Utils_Array::value($dao->name, $params)) {
             $value = $params[$dao->name];
         }
         $params[$dao->name] = $value;
         if ($setInConfig) {
             $config->{$dao->name} = $value;
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:49,代码来源:Setting.php

示例10: triggerInfo

 /**
  * Get a list of triggers for the contact table.
  *
  * @see hook_civicrm_triggerInfo
  * @see CRM_Core_DAO::triggerRebuild
  * @see http://issues.civicrm.org/jira/browse/CRM-10554
  *
  * @param $info
  * @param null $tableName
  */
 public static function triggerInfo(&$info, $tableName = NULL)
 {
     //during upgrade, first check for valid version and then create triggers
     //i.e the columns created_date and modified_date are introduced in 4.3.alpha1 so dont create triggers for older version
     if (CRM_Core_Config::isUpgradeMode()) {
         $currentVer = CRM_Core_BAO_Domain::version(TRUE);
         //if current version is less than 4.3.alpha1 dont create below triggers
         if (version_compare($currentVer, '4.3.alpha1') < 0) {
             return;
         }
     }
     // Update timestamp for civicrm_contact itself
     if ($tableName == NULL || $tableName == self::getTableName()) {
         $info[] = array('table' => array(self::getTableName()), 'when' => 'BEFORE', 'event' => array('INSERT'), 'sql' => "\nSET NEW.created_date = CURRENT_TIMESTAMP;\n");
     }
     // Update timestamp when modifying closely related core tables
     $relatedTables = array('civicrm_address', 'civicrm_email', 'civicrm_im', 'civicrm_phone', 'civicrm_website');
     self::generateTimestampTriggers($info, $tableName, $relatedTables, 'contact_id');
     // Update timestamp when modifying related custom-data tables
     $customGroupTables = array();
     $customGroupDAO = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity('Contact');
     $customGroupDAO->is_multiple = 0;
     $customGroupDAO->find();
     while ($customGroupDAO->fetch()) {
         $customGroupTables[] = $customGroupDAO->table_name;
     }
     if (!empty($customGroupTables)) {
         self::generateTimestampTriggers($info, $tableName, $customGroupTables, 'entity_id');
     }
     // Update phone table to populate phone_numeric field
     if (!$tableName || $tableName == 'civicrm_phone') {
         // Define stored sql function needed for phones
         CRM_Core_DAO::executeQuery(self::DROP_STRIP_FUNCTION_43);
         CRM_Core_DAO::executeQuery(self::CREATE_STRIP_FUNCTION_43);
         $info[] = array('table' => array('civicrm_phone'), 'when' => 'BEFORE', 'event' => array('INSERT', 'UPDATE'), 'sql' => "\nSET NEW.phone_numeric = civicrm_strip_non_numeric(NEW.phone);\n");
     }
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:47,代码来源:Contact.php

示例11: triggerDelete

 /**
  * This function acts as a listener to dao->delete, and deletes an entry from recurring_entity table
  *
  * @param object $event
  *   An object of /Civi/Core/DAO/Event/PostUpdate containing dao object that was just deleted .
  *
  *
  * @return void
  */
 public static function triggerDelete($event)
 {
     $obj =& $event->object;
     // if DB version is earlier than 4.6 skip any processing
     static $currentVer = NULL;
     if (!$currentVer) {
         $currentVer = CRM_Core_BAO_Domain::version();
     }
     if (version_compare($currentVer, '4.6.alpha1') < 0) {
         return;
     }
     static $processedEntities = array();
     if (empty($obj->id) || empty($obj->__table) || !$event->result) {
         return FALSE;
     }
     $key = "{$obj->__table}_{$obj->id}";
     if (array_key_exists($key, $processedEntities)) {
         // already processed
         return NULL;
     }
     // mark being processed
     $processedEntities[$key] = 1;
     $parentID = self::getParentFor($obj->id, $obj->__table);
     if ($parentID) {
         CRM_Core_BAO_RecurringEntity::delEntity($obj->id, $obj->__table, TRUE);
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:36,代码来源:RecurringEntity.php

示例12: getUpgradeVersions

 /**
  * Determine the start and end version of the upgrade process.
  *
  * @return array(0=>$currentVer, 1=>$latestVer)
  */
 public function getUpgradeVersions()
 {
     $latestVer = CRM_Utils_System::version();
     $currentVer = CRM_Core_BAO_Domain::version(TRUE);
     if (!$currentVer) {
         CRM_Core_Error::fatal(ts('Version information missing in civicrm database.'));
     } elseif (stripos($currentVer, 'upgrade')) {
         CRM_Core_Error::fatal(ts('Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again.'));
     }
     if (!$latestVer) {
         CRM_Core_Error::fatal(ts('Version information missing in civicrm codebase.'));
     }
     return array($currentVer, $latestVer);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:19,代码来源:Form.php

示例13: getUpgradeVersions

 /**
  * Determine the start and end version of the upgrade process
  *
  * @return array(0=>$currentVer, 1=>$latestVer)
  */
 function getUpgradeVersions()
 {
     $latestVer = CRM_Utils_System::version();
     $currentVer = CRM_Core_BAO_Domain::version(true);
     if (!$currentVer) {
         CRM_Core_Error::fatal(ts('Version information missing in civicrm database.'));
     } elseif (stripos($currentVer, 'upgrade')) {
         CRM_Core_Error::fatal(ts('Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again.'));
     }
     if (!$latestVer) {
         CRM_Core_Error::fatal(ts('Version information missing in civicrm codebase.'));
     }
     // hack to make past ver compatible /w new incremental upgrade process
     $convertVer = array('2.1' => '2.1.0', '2.2' => '2.2.alpha1', '2.2.alph' => '2.2.alpha3', '3.1.0' => '3.1.1');
     if (isset($convertVer[$currentVer])) {
         $currentVer = $convertVer[$currentVer];
     }
     return array($currentVer, $latestVer);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:24,代码来源:Form.php

示例14: mosaico_civicrm_pageRun

function mosaico_civicrm_pageRun(&$page)
{
    $pageName = $page->getVar('_name');
    if ($pageName == 'Civi\\Angular\\Page\\Main') {
        CRM_Core_Resources::singleton()->addScriptFile('uk.co.vedaconsulting.mosaico', 'js/crmMailingCustom.js', 800);
    }
    if ($pageName == 'CRM_Admin_Page_MessageTemplates') {
        $activeTab = CRM_Utils_Request::retrieve('activeTab', 'String', $form, false, null, 'REQUEST');
        $resultArray = array();
        $smarty = CRM_Core_Smarty::singleton();
        $tableName = MOSAICO_TABLE_NAME;
        $dao = CRM_Core_DAO::executeQuery("SELECT mosaico.*, cmt.msg_title, cmt.msg_subject, cmt.is_active \n      FROM {$tableName} mosaico \n      JOIN civicrm_msg_template cmt ON (cmt.id = mosaico.msg_tpl_id)\n    ");
        while ($dao->fetch()) {
            $resultArray[$dao->id] = $dao->toArray();
            $editURL = CRM_Utils_System::url('civicrm/mosaico/editor', 'snippet=2', FALSE, $dao->hash_key);
            $delURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'action=delete&id=' . $dao->msg_tpl_id);
            $enableDisableText = $dao->is_active ? 'Disable' : 'Enable';
            $action = sprintf('<span>
      <a href="%s" class="action-item crm-hover-button" title="Edit this message template" >Edit</a>
      <a href="#" class="action-item crm-hover-button crm-enable-disable" title="Disable this message template" >%s</a>
      <a href="%s" class="action-item crm-hover-button small-popup" title="Delete this message template" >Delete</a>
      <a href="#" class="action-item crm-hover-button copy-template" value = "%s" title="Copy this message template">Copy</a>
      </span>', $editURL, $enableDisableText, $delURL, $dao->msg_tpl_id);
            $resultArray[$dao->id]['action'] = $action;
        }
        $smarty->assign('mosaicoTemplates', $resultArray);
        $smarty->assign('selectedChild', $activeTab);
        // From civi 4.7, no more tinymce, so if only civi version is less than 4.7 show tinymce.
        //https://civicrm.org/blog/colemanw/big-changes-to-wysiwyg-editing-in-47
        $showTinymceTpl = FALSE;
        $currentVer = CRM_Core_BAO_Domain::version(TRUE);
        if (version_compare($currentVer, '4.7') < 0) {
            $showTinymceTpl = TRUE;
        }
        $smarty->assign('showTinymceTpl', $showTinymceTpl);
    }
}
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.mosaico,代码行数:37,代码来源:mosaico.php

示例15: mte_civicrm_uninstall

/**
 * Implementation of hook_civicrm_uninstall
 */
function mte_civicrm_uninstall()
{
    mte_enableDisableNavigationMenu(2);
    // Change enum for name in civicrm_mailing_bounce_type to remove all Mandrill bounce types
    $config = CRM_Core_Config::singleton();
    if (property_exists($config, 'civiVersion')) {
        $civiVersion = $config->civiVersion;
    } else {
        $civiVersion = CRM_Core_BAO_Domain::version();
    }
    if (version_compare('4.5alpha1', $civiVersion) > 0) {
        CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_mailing_bounce_type` \n  CHANGE `name` `name` ENUM( 'AOL', 'Away', 'DNS', 'Host', 'Inactive', 'Invalid', 'Loop', 'Quota', 'Relay', 'Spam', 'Syntax', 'Unknown' ) \n    CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Type of bounce';");
    }
    return _mte_civix_civicrm_uninstall();
}
开发者ID:vakeesan26,项目名称:biz.jmaconsulting.mte,代码行数:18,代码来源:mte.php


注:本文中的CRM_Core_BAO_Domain::version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。