From 1dab090402d1914fef713344f1baa11b238ae287 Mon Sep 17 00:00:00 2001 From: Annie Kyles Date: Thu, 12 Sep 2024 11:05:43 +1200 Subject: [PATCH 1/2] ENH Update default homepage content (#3001) * name-update: Rename SilverStripe Silverstripe * name-update: Create DEFAULTHOMECONTENT2 content * name-update: Tweak copy Co-authored-by: Steve Boyd * name-update: Tweak copy 2 Co-authored-by: Steve Boyd --------- Co-authored-by: Steve Boyd --- code/Model/SiteTree.php | 2 +- lang/en.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 5f7556d61d..74d583e60c 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -1599,7 +1599,7 @@ public function requireDefaultRecords() if (!SiteTree::get_by_link($defaultHomepage)) { $homepage = new Page(); $homepage->Title = _t(__CLASS__.'.DEFAULTHOMETITLE', 'Home'); - $homepage->Content = _t(__CLASS__.'.DEFAULTHOMECONTENT', '

Welcome to SilverStripe! This is the default homepage. You can edit this page by opening the CMS.

You can now access the developer documentation, or begin the SilverStripe lessons.

'); + $homepage->Content = _t(__CLASS__.'.DEFAULTHOMECONTENT2', '

Welcome to Silverstripe! This is the default homepage. You can edit this page by opening the CMS.

For comprehensive information on Silverstripe CMS, see the developer documentation.

'); $homepage->URLSegment = $defaultHomepage; $homepage->Sort = 1; $homepage->write(); diff --git a/lang/en.yml b/lang/en.yml index 610afc91f6..cf415ee713 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -195,6 +195,7 @@ en: DEFAULTCONTACTCONTENT: '

You can fill this page out with your own content, or delete it and create your own pages.

' DEFAULTCONTACTTITLE: 'Contact Us' DEFAULTHOMECONTENT: '

Welcome to SilverStripe! This is the default homepage. You can edit this page by opening the CMS.

You can now access the developer documentation, or begin the SilverStripe lessons.

' + DEFAULTHOMECONTENT2: '

Welcome to Silverstripe! This is the default homepage. You can edit this page by opening the CMS.

For comprehensive information on Silverstripe CMS, see the developer documentation.

' DEFAULTHOMETITLE: Home DEPENDENT_NOTE: 'The following pages depend on this page. This includes virtual pages, redirector pages, and pages with content links.' DESCRIPTION: 'Generic content page' From 42f72f5b0438a6382b13c4b999a55b9f8603585e Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Wed, 11 Sep 2024 11:38:12 +0100 Subject: [PATCH 2/2] 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 74d583e60c..cda7175d69 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 @@ 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