UpdateConfigBackend: use api4 to flush the cache
authorMathieu Lutfy <mathieu@symbiotic.coop>
Fri, 24 Mar 2023 19:36:26 +0000 (15:36 -0400)
committerMathieu Lutfy <mathieu@bidon.ca>
Fri, 24 Mar 2023 19:36:26 +0000 (15:36 -0400)
CRM/Admin/Form/Setting/UpdateConfigBackend.php

index a1f2683b2bf5ae9b6861b5a0bb82fd48a54fc294..aa7231649c759259da7640af0df58cfc4de38c19 100644 (file)
@@ -45,25 +45,11 @@ class CRM_Admin_Form_Setting_UpdateConfigBackend extends CRM_Admin_Form_Setting
 
   public function postProcess() {
     if (isset($_REQUEST['_qf_UpdateConfigBackend_next_cleanup'])) {
-      $config = CRM_Core_Config::singleton();
-
-      // cleanup templates_c directory
-      $config->cleanup(1, FALSE);
-
-      // clear all caches
-      CRM_Core_Config::clearDBCache();
-      Civi::cache('session')->clear();
-      CRM_Utils_System::flushCache();
-
-      parent::rebuildMenu();
-
-      CRM_Core_BAO_WordReplacement::rebuild();
-
+      \Civi\Api4\System::flush(FALSE)->execute();
       CRM_Core_Session::setStatus(ts('Cache has been cleared and menu has been rebuilt successfully.'), ts("Success"), "success");
     }
     elseif (isset($_REQUEST['_qf_UpdateConfigBackend_next_resetpaths'])) {
       $msg = CRM_Core_BAO_ConfigSetting::doSiteMove();
-
       CRM_Core_Session::setStatus($msg, ts("Success"), "success");
     }