X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUpgrade%2FSnapshot.php;h=9f5a493844f298b7c47ddcb8229fb0743a772df1;hb=1181545c471dc03db5c85aa11926dbd0da27149f;hp=fd52b602ff93a8ba4be572082e4fc9d9ddfde19e;hpb=1602aa08f85d12d70fd4ff5fd19d0f5c1092ff8e;p=civicrm-core.git diff --git a/CRM/Upgrade/Snapshot.php b/CRM/Upgrade/Snapshot.php index fd52b602ff..9f5a493844 100644 --- a/CRM/Upgrade/Snapshot.php +++ b/CRM/Upgrade/Snapshot.php @@ -40,7 +40,10 @@ class CRM_Upgrade_Snapshot { */ public static function getActivationIssues(): array { if (static::$activationIssues === NULL) { - // TODO This policy should probably be more configurable, eg via `setting` or `define()`. + $policy = CRM_Utils_Constant::value('CIVICRM_UPGRADE_SNAPSHOT', 'auto'); + if ($policy === TRUE) { + return []; + } $limits = [ 'civicrm_contact' => 200 * 1000, @@ -71,6 +74,10 @@ class CRM_Upgrade_Snapshot { if (CRM_Core_I18n::isMultilingual()) { static::$activationIssues['multilingual'] = ts('Multilingual snapshots have not been implemented.'); } + + if ($policy === FALSE) { + static::$activationIssues['override'] = ts('Snapshots disabled by override (CIVICRM_UPGRADE_SNAPSHOT).'); + } } return static::$activationIssues; @@ -177,8 +184,9 @@ class CRM_Upgrade_Snapshot { * How long should we retain old snapshots? * Time is measured in terms of MINOR versions - eg "4" means "retain for 4 MINOR versions". * Thus, on v5.60, you could delete any snapshots predating 5.56. + * @return bool */ - public static function cleanupTask(?CRM_Queue_TaskContext $ctx = NULL, string $owner = 'civicrm', ?string $version = NULL, ?int $cleanupAfter = NULL): void { + public static function cleanupTask(?CRM_Queue_TaskContext $ctx = NULL, string $owner = 'civicrm', ?string $version = NULL, ?int $cleanupAfter = NULL): bool { $version = $version ?: CRM_Core_BAO_Domain::version(); $cleanupAfter = $cleanupAfter ?: static::$cleanupAfter; @@ -206,6 +214,7 @@ class CRM_Upgrade_Snapshot { }); array_map(['CRM_Core_BAO_SchemaHandler', 'dropTable'], $oldTables); + return TRUE; } }