Skip to content

Commit

Permalink
FIX: Remove legacy fields which prevent page publish (fixes #2455)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinglozzer committed Sep 12, 2024
1 parent 1dab090 commit 3ddec1c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion code/Model/SiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,16 @@ 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[]
* @config
*/
private static array $fields_ignored_by_versioning = [
'HasBrokenFile',
'HasBrokenLink',
];

private static $default_sort = "\"Sort\"";

/**
Expand Down Expand Up @@ -1692,7 +1702,7 @@ protected function onBeforeWrite()
}

// 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
Expand Down

0 comments on commit 3ddec1c

Please sign in to comment.