Merge pull request #3580 from monishdeb/CRM-14701
[civicrm-core.git] / CRM / Core / Invoke.php
index 516845ff4c8878b5ad1a44240e8125050d455c19..b06fd360e8d82b926fe5dbc9ff59f31107425d54 100644 (file)
@@ -418,22 +418,6 @@ class CRM_Core_Invoke {
       $session = CRM_Core_Session::singleton();
       $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'reset=1'));
 
-      $buttonType = CRM_Utils_Array::value('_qf_Edit_cancel', $_POST);
-      // CRM-5849: we should actually check the button *type*, but we get the *value*, potentially translated;
-      // we should keep both English and translated checks just to make sure we also handle untranslated Cancels
-      if ($buttonType == 'Cancel' or $buttonType == ts('Cancel')) {
-        $cancelURL = CRM_Utils_Request::retrieve('cancelURL',
-          'String',
-          CRM_Core_DAO::$_nullObject,
-          FALSE,
-          NULL,
-          $_POST
-        );
-        if ($cancelURL) {
-          CRM_Utils_System::redirect($cancelURL);
-        }
-      }
-
       if ($secondArg == 'edit') {
         $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit',
           ts('Create Profile'),
@@ -483,14 +467,14 @@ class CRM_Core_Invoke {
     $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 all caches
-    $config->cleanupCaches($sessionReset || CRM_Utils_Request::retrieve('sessionReset', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
-
     // also cleanup module permissions
     $config->cleanupPermissions();
 
@@ -507,7 +491,7 @@ class CRM_Core_Invoke {
     ) {
       CRM_Core_DAO::triggerRebuild();
     }
-
+    CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE);
     CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
   }
 }