From 42f72f5b0438a6382b13c4b999a55b9f8603585e Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Wed, 11 Sep 2024 11:38:12 +0100 Subject: [PATCH] FIX: Remove legacy fields which prevent page publish (fixes #2455) --- code/Model/SiteTree.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 74d583e6..cda7175d 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -300,6 +300,15 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi "Stage", "Live" ]; + /** + * Fields which, if changed on their own, won't cause a new version/live record to be created + * @var string[] + */ + private static array $fields_ignored_by_versioning = [ + 'HasBrokenFile', + 'HasBrokenLink', + ]; + private static $default_sort = "\"Sort\""; /** @@ -1692,7 +1701,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi } // Check to see if we've only altered fields that shouldn't affect versioning - $fieldsIgnoredByVersioning = ['HasBrokenLink', 'Status', 'HasBrokenFile', 'ToDo', 'VersionID', 'SaveCount']; + $fieldsIgnoredByVersioning = $this->config()->get('fields_ignored_by_versioning') ?? []; $changedFields = array_keys($this->getChangedFields(true, 2) ?? []); // This more rigorous check is inline with the test that write() does to decide whether or not to write to the