/**
  * Pre process function.
  */
 public function preProcess()
 {
     // This controller was originally written to CRUD $config->locale_custom_strings,
     // but that's no longer the canonical store. Re-sync from canonical store to ensure
     // that we display that latest data. This is inefficient - at some point, we
     // should rewrite this UI.
     CRM_Core_BAO_WordReplacement::rebuild(FALSE);
     $this->_soInstance = CRM_Utils_Array::value('instance', $_GET);
     $this->assign('soInstance', $this->_soInstance);
 }
 function preProcess()
 {
     // This controller was originally written to CRUD $config->locale_custom_strings,
     // but that's no longer the canonical store. Re-sync from canonical store to ensure
     // that we display that latest data. This is inefficient - at some point, we
     // should rewrite this UI.
     CRM_Core_BAO_WordReplacement::rebuild();
     $this->_soInstance = CRM_Utils_Array::value('instance', $_GET);
     $this->assign('soInstance', $this->_soInstance);
     $breadCrumbUrl = CRM_Utils_System::url('civicrm/admin/options/wordreplacements', "reset=1");
     $breadCrumb = array(array('title' => ts('Word Replacements'), 'url' => $breadCrumbUrl));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
 }
 public function postProcess()
 {
     if (!empty($_POST['_qf_UpdateConfigBackend_next_cleanup'])) {
         $config = CRM_Core_Config::singleton();
         // cleanup templates_c directory
         $config->cleanup(1, FALSE);
         // clear all caches
         CRM_Core_Config::clearDBCache();
         CRM_Utils_System::flushCache();
         parent::rebuildMenu();
         CRM_Core_BAO_WordReplacement::rebuild();
         CRM_Core_Session::setStatus(ts('Cache has been cleared and menu has been rebuilt successfully.'), ts("Success"), "success");
     }
     if (!empty($_POST['_qf_UpdateConfigBackend_next_resetpaths'])) {
         $msg = CRM_Core_BAO_ConfigSetting::doSiteMove();
         CRM_Core_Session::setStatus($msg, ts("Success"), "success");
     }
     return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/setting/updateConfigBackend', 'reset=1'));
 }
Esempio n. 4
0
 static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $config->clearModuleList();
     // also cleanup all caches
     $config->cleanupCaches($sessionReset || CRM_Utils_Request::retrieve('sessionReset', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
     CRM_Core_Menu::store();
     // also reset navigation
     CRM_Core_BAO_Navigation::resetNavigation();
     // also cleanup module permissions
     $config->cleanupPermissions();
     // also rebuild word replacement cache
     CRM_Core_BAO_WordReplacement::rebuild();
     CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     CRM_Core_Resources::singleton()->resetCacheCode();
     // also rebuild triggers if requested explicitly
     if ($triggerRebuild || CRM_Utils_Request::retrieve('triggerRebuild', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')) {
         CRM_Core_DAO::triggerRebuild();
     }
     CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE);
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
 }
 /**
  * Rebuild word replacements.
  *
  * Get all the word-replacements stored in config-arrays
  * and write them out as records in civicrm_word_replacement.
  *
  * Note: This function is duplicated in CRM_Core_BAO_WordReplacement and
  * CRM_Upgrade_Incremental_php_FourFour to ensure that the incremental upgrade
  * step behaves consistently even as the BAO evolves in future versions.
  * However, if there's a bug in here prior to 4.4.0, we should apply the
  * bug-fix in both places.
  */
 public static function rebuildWordReplacementTable()
 {
     civicrm_api3('word_replacement', 'replace', array('options' => array('match' => array('domain_id', 'find_word')), 'values' => self::getConfigArraysAsAPIParams(FALSE)));
     CRM_Core_BAO_WordReplacement::rebuild();
 }
Esempio n. 6
0
 /**
  * @param bool $triggerRebuild
  * @param bool $sessionReset
  *
  * @throws Exception
  */
 public static function rebuildMenuAndCaches($triggerRebuild = FALSE, $sessionReset = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $config->clearModuleList();
     // also cleanup all caches
     $config->cleanupCaches($sessionReset || CRM_Utils_Request::retrieve('sessionReset', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
     CRM_Core_Menu::store();
     // also reset navigation
     CRM_Core_BAO_Navigation::resetNavigation();
     // also cleanup module permissions
     $config->cleanupPermissions();
     // rebuild word replacement cache - pass false to prevent operations redundant with this fn
     CRM_Core_BAO_WordReplacement::rebuild(FALSE);
     Civi::service('settings_manager')->flush();
     // Clear js caches
     CRM_Core_Resources::singleton()->flushStrings()->resetCacheCode();
     CRM_Case_XMLRepository::singleton(TRUE);
     // also rebuild triggers if requested explicitly
     if ($triggerRebuild || CRM_Utils_Request::retrieve('triggerRebuild', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')) {
         CRM_Core_DAO::triggerRebuild();
     }
     CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE);
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
     //CRM-16257 update Config.IDS.ini might be an old copy
     CRM_Core_IDS::createConfigFile(TRUE);
 }
Esempio n. 7
0
/**
 * This api cleans up all the old session entries and temp tables.
 *
 * We recommend that sites run this on an hourly basis.
 *
 * @param array $params
 *   Sends in various config parameters to decide what needs to be cleaned.
 */
function civicrm_api3_job_cleanup($params)
{
    $session = CRM_Utils_Array::value('session', $params, TRUE);
    $tempTable = CRM_Utils_Array::value('tempTables', $params, TRUE);
    $jobLog = CRM_Utils_Array::value('jobLog', $params, TRUE);
    $prevNext = CRM_Utils_Array::value('prevNext', $params, TRUE);
    $dbCache = CRM_Utils_Array::value('dbCache', $params, FALSE);
    $memCache = CRM_Utils_Array::value('memCache', $params, FALSE);
    $tplCache = CRM_Utils_Array::value('tplCache', $params, FALSE);
    $wordRplc = CRM_Utils_Array::value('wordRplc', $params, FALSE);
    if ($session || $tempTable || $prevNext) {
        CRM_Core_BAO_Cache::cleanup($session, $tempTable, $prevNext);
    }
    if ($jobLog) {
        CRM_Core_BAO_Job::cleanup();
    }
    if ($tplCache) {
        $config = CRM_Core_Config::singleton();
        $config->cleanup(1, FALSE);
    }
    if ($dbCache) {
        CRM_Core_Config::clearDBCache();
    }
    if ($memCache) {
        CRM_Utils_System::flushCache();
    }
    if ($wordRplc) {
        CRM_Core_BAO_WordReplacement::rebuild();
    }
}
 function postProcess()
 {
     if (!empty($_POST['_qf_UpdateConfigBackend_next_cleanup'])) {
         $config = CRM_Core_Config::singleton();
         // cleanup templates_c directory
         $config->cleanup(1, FALSE);
         // clear db caching
         CRM_Core_Config::clearDBCache();
         parent::rebuildMenu();
         CRM_Core_BAO_WordReplacement::rebuild();
         CRM_Core_Session::setStatus(ts('Cache has been cleared and menu has been rebuilt successfully.'), ts("Success"), "success");
         return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/setting/updateConfigBackend', 'reset=1'));
     }
     // redirect to admin page after saving
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/admin'));
     $params = $this->controller->exportValues($this->_name);
     //CRM-5679
     foreach ($params as $name => &$val) {
         if ($val && in_array($name, array('newBaseURL', 'newBaseDir', 'newSiteName'))) {
             $val = CRM_Utils_File::addTrailingSlash($val);
         }
     }
     $from = array($this->_oldBaseURL, $this->_oldBaseDir);
     $to = array(trim($params['newBaseURL']), trim($params['newBaseDir']));
     if ($this->_oldSiteName && $params['newSiteName']) {
         $from[] = $this->_oldSiteName;
         $to[] = $params['newSiteName'];
     }
     $newValues = str_replace($from, $to, $this->_defaults);
     parent::commonProcess($newValues);
     parent::rebuildMenu();
 }