Esempio n. 1
0
 /**
  * Add records of the extension to the database -- and enable it
  *
  * @param array $keys
  *   List of extension keys.
  * @throws CRM_Extension_Exception
  */
 public function install($keys)
 {
     $origStatuses = $this->getStatuses();
     // TODO: to mitigate the risk of crashing during installation, scan
     // keys/statuses/types before doing anything
     foreach ($keys as $key) {
         list($info, $typeManager) = $this->_getInfoTypeHandler($key);
         // throws Exception
         switch ($origStatuses[$key]) {
             case self::STATUS_INSTALLED:
                 // ok, nothing to do
                 break;
             case self::STATUS_DISABLED:
                 // re-enable it
                 $typeManager->onPreEnable($info);
                 $this->_setExtensionActive($info, 1);
                 $typeManager->onPostEnable($info);
                 break;
             case self::STATUS_UNINSTALLED:
                 // install anew
                 $typeManager->onPreInstall($info);
                 $this->_createExtensionEntry($info);
                 $typeManager->onPostInstall($info);
                 break;
             case self::STATUS_UNKNOWN:
             default:
                 throw new CRM_Extension_Exception("Cannot install or enable extension: {$key}");
         }
     }
     $this->statuses = NULL;
     $this->mapper->refresh();
     CRM_Core_Invoke::rebuildMenuAndCaches(TRUE);
     $schema = new CRM_Logging_Schema();
     $schema->fixSchemaDifferences();
     foreach ($keys as $key) {
         list($info, $typeManager) = $this->_getInfoTypeHandler($key);
         // throws Exception
         switch ($origStatuses[$key]) {
             case self::STATUS_INSTALLED:
                 // ok, nothing to do
                 break;
             case self::STATUS_DISABLED:
                 // re-enable it
                 break;
             case self::STATUS_UNINSTALLED:
                 // install anew
                 $typeManager->onPostPostInstall($info);
                 break;
             case self::STATUS_UNKNOWN:
             default:
                 throw new CRM_Extension_Exception("Cannot install or enable extension: {$key}");
         }
     }
 }
/**
 * Implements hook_civicrm_uninstall().
 *
 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall
 */
function mosaico_civicrm_uninstall()
{
    _mosaico_civix_civicrm_uninstall();
    $schema = new CRM_Logging_Schema();
    $schema->fixSchemaDifferences();
}
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 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);
 }