コード例 #1
0
ファイル: Schema.php プロジェクト: hguru/224Civi
 /**
  * Switch database from multi-lang back to single (by dropping
  * additional columns and views and retaining only the selected locale).
  *
  * @param $retain string  the locale to retain
  *
  * @return void
  */
 static function makeSinglelingual($retain)
 {
     $domain = new CRM_Core_DAO_Domain();
     $domain->find(TRUE);
     $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
     // break early if the db is already single-lang
     if (!$locales) {
         return;
     }
     // lets drop all triggers first
     $logging = new CRM_Logging_Schema();
     $logging->dropTriggers();
     // turn subsequent tables singlelingual
     $tables = CRM_Core_I18n_SchemaStructure::tables();
     foreach ($tables as $table) {
         self::makeSinglelingualTable($retain, $table);
     }
     // update civicrm_domain.locales
     $domain->locales = 'NULL';
     $domain->save();
     //CRM-6963 -fair assumption.
     global $dbLocale;
     $dbLocale = '';
     // now lets rebuild all triggers
     CRM_Core_DAO::triggerRebuild();
 }
コード例 #2
0
ファイル: DAO.php プロジェクト: konadave/civicrm-core
 /**
  * Wrapper function to drop triggers.
  *
  * @param string $tableName
  *   the specific table requiring a rebuild; or NULL to rebuild all tables.
  */
 public static function dropTriggers($tableName = NULL)
 {
     $info = array();
     $logging = new CRM_Logging_Schema();
     $logging->triggerInfo($info, $tableName);
     // drop all existing triggers on all tables
     $logging->dropTriggers($tableName);
 }
コード例 #3
0
 static function triggerRebuild($tableName = NULL)
 {
     $info = array();
     $logging = new CRM_Logging_Schema();
     $logging->triggerInfo($info, $tableName);
     CRM_Core_I18n_Schema::triggerInfo($info, $tableName);
     CRM_Utils_Hook::triggerInfo($info, $tableName);
     // drop all existing triggers on all tables
     $logging->dropTriggers($tableName);
     // now create the set of new triggers
     self::createTriggers($info);
 }