CRM_Core_BAO_Setting - Don't prefill settings
[civicrm-core.git] / CRM / Core / Invoke.php
index 48d71a52c2905abef8345a5852fe263b48c0c1bc..24c0ecf77e7da2275941c674309b09c6af95ae3f 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -31,7 +31,7 @@
  * Serves as a wrapper between the UserFrameWork and Core CRM
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -125,7 +125,7 @@ class CRM_Core_Invoke {
   }
 
   /**
-   * Perform general setup
+   * Perform general setup.
    *
    * @param array $args
    *   List of path parts.
@@ -257,7 +257,7 @@ class CRM_Core_Invoke {
       }
       else {
         $template->assign('urlIsPublic', FALSE);
-        self::versionCheck($template);
+        self::statusCheck($template);
       }
 
       if (isset($item['return_url'])) {
@@ -271,12 +271,11 @@ class CRM_Core_Invoke {
       }
 
       $result = NULL;
-      if (is_array($item['page_callback'])) {
-        if ($item['page_callback']{0} !== '\\') {
-          // Legacy class-loading for PHP 5.2 namespaces; not sure it's needed, but counter-productive for PHP 5.3 namespaces
-          require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback'][0]) . '.php';
-        }
-        $result = call_user_func($item['page_callback']);
+      // WISHLIST: Refactor this. Instead of pattern-matching on page_callback, lookup
+      // page_callback via Civi\Core\Resolver and check the implemented interfaces. This
+      // would require rethinking the default constructor.
+      if (is_array($item['page_callback']) || strpos($item['page_callback'], ':')) {
+        $result = call_user_func(Civi\Core\Resolver::singleton()->get($item['page_callback']));
       }
       elseif (strstr($item['page_callback'], '_Form')) {
         $wrapper = new CRM_Utils_Wrapper();
@@ -288,10 +287,6 @@ class CRM_Core_Invoke {
       }
       else {
         $newArgs = explode('/', $_GET[$config->userFrameworkURLVar]);
-        if ($item['page_callback']{0} !== '\\') {
-          // Legacy class-loading for PHP 5.2 namespaces; not sure it's needed, but counter-productive for PHP 5.3 namespaces
-          require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback']) . '.php';
-        }
         $mode = 'null';
         if (isset($pageArgs['mode'])) {
           $mode = $pageArgs['mode'];
@@ -327,7 +322,7 @@ class CRM_Core_Invoke {
   }
 
   /**
-   * This function contains the default action
+   * This function contains the default action.
    *
    * @param $action
    *
@@ -349,23 +344,19 @@ class CRM_Core_Invoke {
   }
 
   /**
-   * Show the message about CiviCRM versions
+   * Show status in the footer
    *
    * @param CRM_Core_Smarty $template
    */
-  public static function versionCheck($template) {
+  public static function statusCheck($template) {
     if (CRM_Core_Config::isUpgradeMode()) {
       return;
     }
-    $newerVersion = $securityUpdate = NULL;
-    if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionAlert', NULL, 1) & 1) {
-      $newerVersion = CRM_Utils_VersionCheck::singleton()->isNewerVersionAvailable();
-    }
-    if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'securityUpdateAlert', NULL, 3) & 1) {
-      $securityUpdate = CRM_Utils_VersionCheck::singleton()->isSecurityUpdateAvailable();
-    }
-    $template->assign('newer_civicrm_version', $newerVersion);
-    $template->assign('security_update', $securityUpdate);
+    $statusSeverity = 0;
+    $statusMessage = ts('System status OK');
+    // TODO: get status from CRM_Utils_Check, if cached
+    $template->assign('footer_status_severity', $statusSeverity);
+    $template->assign('footer_status_message', $statusMessage);
   }
 
   /**
@@ -392,7 +383,7 @@ class CRM_Core_Invoke {
     // rebuild word replacement cache - pass false to prevent operations redundant with this fn
     CRM_Core_BAO_WordReplacement::rebuild(FALSE);
 
-    CRM_Core_BAO_Setting::updateSettingsFromMetaData();
+    Civi::service('settings_manager')->flush();
     // Clear js caches
     CRM_Core_Resources::singleton()->flushStrings()->resetCacheCode();
     CRM_Case_XMLRepository::singleton(TRUE);
@@ -406,6 +397,9 @@ class CRM_Core_Invoke {
     }
     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);
   }
 
 }