From: Tim Otten Date: Mon, 20 Apr 2020 21:10:30 +0000 (-0700) Subject: dev/core#1460 - Implement first draft of DispatchPolicy X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1c3c339421bc886e1fdd54d66f658f4fdfc2998b;p=civicrm-core.git dev/core#1460 - Implement first draft of DispatchPolicy --- diff --git a/CRM/Upgrade/DispatchPolicy.php b/CRM/Upgrade/DispatchPolicy.php new file mode 100644 index 0000000000..9403bd253c --- /dev/null +++ b/CRM/Upgrade/DispatchPolicy.php @@ -0,0 +1,96 @@ + 'run', + '/^hook_civicrm_(pre|post)$/' => 'drop', + '/^hook_civicrm_/' => $strict ? 'warn-drop' : 'drop', + '/^civi\./' => 'run', + '/./' => $strict ? 'warn-drop' : 'drop', + ]; + + // The "upgrade.finish" policy applies at the end while performing the final clear/rebuild. + // It's more permissive, allowing more data-structures to rehydrate correctly. + $policies['upgrade.finish'] = [ + '/^hook_civicrm_(pre|post)$/' => 'drop', + '/./' => 'run', + ]; + + // For comparison, "upgrade.old" is an estimation of the previous policy. It + // was applied at all times during the upgrade. + $policies['upgrade.old'] = [ + 'hook_civicrm_alterSettingsFolders' => 'run', + 'hook_civicrm_alterSettingsMetaData' => 'run', + 'hook_civicrm_triggerInfo' => 'run', + 'hook_civicrm_alterLogTables' => 'run', + 'hook_civicrm_container' => 'run', + 'hook_civicrm_permission' => 'run', + 'hook_civicrm_managed' => 'run', + 'hook_civicrm_config' => 'run', + '/^hook_civicrm_(pre|post)$/' => 'drop', + '/^hook_civicrm_/' => 'drop', + '/^civi\./' => 'run', + '/./' => 'run', + ]; + + return $policies['upgrade.old']; + // return $policies[$phase]; + } + +}