diff --git a/_config.php b/_config.php
index 50511c6ef2..d19bd89d2c 100644
--- a/_config.php
+++ b/_config.php
@@ -37,5 +37,8 @@
CMSMenu::remove_menu_class(CMSMain::class);
CMSMenu::remove_menu_class(CMSPageEditController::class);
CMSMenu::remove_menu_class(CMSPageSettingsController::class);
-CMSMenu::remove_menu_class(CMSPageHistoryController::class);
+if (class_exists(CMSPageHistoryController::class)) {
+ // this class will be removed in CMS 5
+ CMSMenu::remove_menu_class(CMSPageHistoryController::class);
+}
CMSMenu::remove_menu_class(CMSPageAddController::class);
diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php
index 424e9eb133..2107c61c24 100644
--- a/code/Controllers/CMSMain.php
+++ b/code/Controllers/CMSMain.php
@@ -72,6 +72,7 @@
use SilverStripe\View\ArrayData;
use SilverStripe\View\Requirements;
use Translatable;
+use SilverStripe\VersionedAdmin\Controllers\CMSPageHistoryViewerController;
/**
* The main "content" area of the CMS.
@@ -411,7 +412,7 @@ public function LinkPageHistory()
{
if ($id = $this->currentPageID()) {
return $this->LinkWithSearch(
- Controller::join_links(CMSPageHistoryController::singleton()->Link('show'), $id)
+ Controller::join_links(CMSPageHistoryViewerController::singleton()->Link('show'), $id)
);
} else {
return null;
diff --git a/code/Controllers/CMSPageHistoryController.php b/code/Controllers/CMSPageHistoryController.php
index 7ffcc88dee..0520ecdbfa 100644
--- a/code/Controllers/CMSPageHistoryController.php
+++ b/code/Controllers/CMSPageHistoryController.php
@@ -63,7 +63,9 @@ class CMSPageHistoryController extends CMSMain
public function __construct()
{
parent::__construct();
- Deprecation::notice('4.3.0', 'Use silverstripe/versioned-admin instead', Deprecation::SCOPE_CLASS);
+ Deprecation::withNoReplacement(function () {
+ Deprecation::notice('4.3.0', 'Use silverstripe/versioned-admin instead', Deprecation::SCOPE_CLASS);
+ });
}
public function getResponseNegotiator()
@@ -308,7 +310,7 @@ public function VersionsForm()
$compareModeChecked = ($action == "compare");
if ($page) {
- $versions = $page->allVersions();
+ $versions = $page->Versions();
$versionID = (!$versionID) ? $page->Version : $versionID;
if ($versions) {
diff --git a/code/Controllers/SilverStripeNavigator.php b/code/Controllers/SilverStripeNavigator.php
index dce05372ab..9373efddd2 100644
--- a/code/Controllers/SilverStripeNavigator.php
+++ b/code/Controllers/SilverStripeNavigator.php
@@ -66,7 +66,7 @@ public function getItems()
}
ksort($items);
- // Drop the keys and let the ArrayList handle the numbering, so $First, $Last and others work properly.
+ // Drop the keys and let the ArrayList handle the numbering, so $IsFirst, $IsLast and others work properly.
return new ArrayList(array_values($items ?? []));
}
diff --git a/code/Model/SiteTreeFileFormFactoryExtension.php b/code/Model/SiteTreeFileFormFactoryExtension.php
index e20c95ecce..59773030d4 100644
--- a/code/Model/SiteTreeFileFormFactoryExtension.php
+++ b/code/Model/SiteTreeFileFormFactoryExtension.php
@@ -18,12 +18,10 @@
* Uses tracking provided by {@see SiteTreeFileExtension} to generate this.
*
* @property File $owner
+ * @deprecated 4.12.0 Use UsedOnTable instead
*/
class SiteTreeFileFormFactoryExtension extends DataExtension
{
- /**
- * @deprecated 4.12.0 Use UsedOnTable instead
- */
public function __construct()
{
Deprecation::notice('4.12.0', 'Use UsedOnTable instead', Deprecation::SCOPE_CLASS);
diff --git a/composer.json b/composer.json
index e3186a661f..278ea8543e 100644
--- a/composer.json
+++ b/composer.json
@@ -25,6 +25,7 @@
"silverstripe/reports": "^4.7@dev",
"silverstripe/siteconfig": "^4.7@dev",
"silverstripe/versioned": "^1.7@dev",
+ "silverstripe/versioned-admin": "^1.7@dev",
"silverstripe/vendor-plugin": "^1.0",
"php": "^7.4 || ^8.0"
},
diff --git a/templates/BreadcrumbsTemplate.ss b/templates/BreadcrumbsTemplate.ss
index a2ccd5a908..912382aa3a 100755
--- a/templates/BreadcrumbsTemplate.ss
+++ b/templates/BreadcrumbsTemplate.ss
@@ -1,4 +1,4 @@
<%-- Loop is all on one line to prevent whitespace bug in older versions of IE --%>
<% if $Pages %>
- <% loop $Pages %><% if $Last %>$MenuTitle.XML<% else %><% if not Up.Unlinked %><% end_if %>$MenuTitle.XML<% if not Up.Unlinked %><% end_if %> $Up.Delimiter.RAW <% end_if %><% end_loop %>
+ <% loop $Pages %><% if $IsLast %>$MenuTitle.XML<% else %><% if not Up.Unlinked %><% end_if %>$MenuTitle.XML<% if not Up.Unlinked %><% end_if %> $Up.Delimiter.RAW <% end_if %><% end_loop %>
<% end_if %>
diff --git a/tests/php/Controllers/CMSBatchActionsTest.php b/tests/php/Controllers/CMSBatchActionsTest.php
index 9a079b8073..3ec33d5681 100644
--- a/tests/php/Controllers/CMSBatchActionsTest.php
+++ b/tests/php/Controllers/CMSBatchActionsTest.php
@@ -26,7 +26,7 @@ protected function setUp(): void
$this->logInWithPermission('ADMIN');
// Tests assume strict hierarchy is enabled
- Config::inst()->update(SiteTree::class, 'enforce_strict_hierarchy', true);
+ Config::inst()->set(SiteTree::class, 'enforce_strict_hierarchy', true);
// published page
$published = $this->objFromFixture(SiteTree::class, 'published');
diff --git a/tests/php/Controllers/CMSMainTest.php b/tests/php/Controllers/CMSMainTest.php
index f61158f427..c8a8bfc501 100644
--- a/tests/php/Controllers/CMSMainTest.php
+++ b/tests/php/Controllers/CMSMainTest.php
@@ -25,6 +25,7 @@
use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Versioned\Versioned;
+use SilverStripe\Dev\Deprecation;
class CMSMainTest extends FunctionalTest
{
@@ -123,6 +124,9 @@ public function testChildFilter()
*/
public function testPublish()
{
+ if (Deprecation::isEnabled()) {
+ $this->markTestSkipped('Test calls deprecated code');
+ }
$page1 = $this->objFromFixture(Page::class, "page1");
$page2 = $this->objFromFixture(Page::class, "page2");
$this->logInAs('admin');
diff --git a/tests/php/Controllers/CMSPageHistoryControllerTest.php b/tests/php/Controllers/CMSPageHistoryControllerTest.php
index 40d564b500..4100436cbf 100755
--- a/tests/php/Controllers/CMSPageHistoryControllerTest.php
+++ b/tests/php/Controllers/CMSPageHistoryControllerTest.php
@@ -12,6 +12,7 @@
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\HTMLReadonlyField;
+use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\TextField;
class CMSPageHistoryControllerTest extends FunctionalTest
@@ -32,10 +33,12 @@ protected function setUp(): void
{
parent::setUp();
- Injector::inst()->registerService(
- new CMSPageHistoryController(),
- CMSPageHistoryController::class
- );
+ Deprecation::withNoReplacement(function () {
+ Injector::inst()->registerService(
+ new CMSPageHistoryController(),
+ CMSPageHistoryController::class
+ );
+ });
$this->loginWithPermission('ADMIN');
@@ -62,6 +65,9 @@ protected function setUp(): void
public function testGetEditForm()
{
+ if (Deprecation::isEnabled()) {
+ $this->markTestSkipped('Test calls deprecated code');
+ }
$controller = new CMSPageHistoryController();
$controller->setRequest(Controller::curr()->getRequest());
@@ -108,7 +114,10 @@ public function testGetEditForm()
*/
public function testVersionsForm()
{
- $this->get('admin/pages/legacyhistory/show/'. $this->page->ID);
+ if (Deprecation::isEnabled()) {
+ $this->markTestSkipped('Test calls deprecated code');
+ }
+ $this->get('admin/pages/legacyhistory/show/' . $this->page->ID);
$form = $this->cssParser()->getBySelector('#Form_VersionsForm');
@@ -127,7 +136,10 @@ public function testVersionsForm()
public function testVersionsFormTableContainsInformation()
{
- $this->get('admin/pages/legacyhistory/show/'. $this->page->ID);
+ if (Deprecation::isEnabled()) {
+ $this->markTestSkipped('Test calls deprecated code');
+ }
+ $this->get('admin/pages/legacyhistory/show/' . $this->page->ID);
$form = $this->cssParser()->getBySelector('#Form_VersionsForm');
$rows = $form[0]->xpath("fieldset/table/tbody/tr");
@@ -153,7 +165,10 @@ public function testVersionsFormTableContainsInformation()
public function testVersionsFormSelectsUnpublishedCheckbox()
{
- $this->get('admin/pages/legacyhistory/show/'. $this->page->ID);
+ if (Deprecation::isEnabled()) {
+ $this->markTestSkipped('Test calls deprecated code');
+ }
+ $this->get('admin/pages/legacyhistory/show/' . $this->page->ID);
$checkbox = $this->cssParser()->getBySelector('#Form_VersionsForm_ShowUnpublished');
$this->assertThat($checkbox[0], $this->logicalNot($this->isNull()));
@@ -162,7 +177,7 @@ public function testVersionsFormSelectsUnpublishedCheckbox()
$this->assertThat($checked, $this->logicalNot($this->stringContains('checked')));
// viewing an unpublished
- $this->get('admin/pages/legacyhistory/show/'.$this->page->ID .'/'.$this->versionUnpublishedCheck);
+ $this->get('admin/pages/legacyhistory/show/' . $this->page->ID . '/' . $this->versionUnpublishedCheck);
$checkbox = $this->cssParser()->getBySelector('#Form_VersionsForm_ShowUnpublished');
$this->assertThat($checkbox[0], $this->logicalNot($this->isNull()));
@@ -171,6 +186,9 @@ public function testVersionsFormSelectsUnpublishedCheckbox()
public function testTransformReadonly()
{
+ if (Deprecation::isEnabled()) {
+ $this->markTestSkipped('Test calls deprecated code');
+ }
/** @var CMSPageHistoryController $history */
$history = new CMSPageHistoryController();
$history->setRequest(Controller::curr()->getRequest());
diff --git a/tests/php/Model/RedirectorPageTest.php b/tests/php/Model/RedirectorPageTest.php
index b49998c86c..fa007731f6 100644
--- a/tests/php/Model/RedirectorPageTest.php
+++ b/tests/php/Model/RedirectorPageTest.php
@@ -33,7 +33,7 @@ protected function setUp(): void
$file->publishSingle();
}
- Director::config()->update('alternate_base_url', 'http://www.mysite.com/');
+ Director::config()->set('alternate_base_url', 'http://www.mysite.com/');
// Ensure all pages are published
/** @var Page $page */
diff --git a/tests/php/Model/SiteTreeTest.php b/tests/php/Model/SiteTreeTest.php
index 86880f7cc5..a56740f3a2 100644
--- a/tests/php/Model/SiteTreeTest.php
+++ b/tests/php/Model/SiteTreeTest.php
@@ -39,6 +39,7 @@
use SilverStripe\View\Shortcodes\EmbedShortcodeProvider;
use TractorCow\Fluent\Extension\FluentSiteTreeExtension;
use const RESOURCES_DIR;
+use SilverStripe\Dev\Deprecation;
class SiteTreeTest extends SapphireTest
{
@@ -430,7 +431,7 @@ public function testRestoreToStage()
public function testNoCascadingDeleteWithoutID()
{
- Config::inst()->update('SiteTree', 'enforce_strict_hierarchy', true);
+ Config::inst()->set('SiteTree', 'enforce_strict_hierarchy', true);
$count = SiteTree::get()->count();
$this->assertNotEmpty($count);
$obj = new SiteTree();
@@ -1253,27 +1254,27 @@ public function testAllowedChildrenValidation()
$classCext->write();
$classB->ParentID = $page->ID;
- $valid = $classB->doValidate();
+ $valid = $classB->validate();
$this->assertTrue($valid->isValid(), "Does allow children on unrestricted parent");
$classB->ParentID = $classA->ID;
- $valid = $classB->doValidate();
+ $valid = $classB->validate();
$this->assertTrue($valid->isValid(), "Does allow child specifically allowed by parent");
$classC->ParentID = $classA->ID;
- $valid = $classC->doValidate();
+ $valid = $classC->validate();
$this->assertFalse($valid->isValid(), "Doesnt allow child on parents specifically restricting children");
$classB->ParentID = $classC->ID;
- $valid = $classB->doValidate();
+ $valid = $classB->validate();
$this->assertFalse($valid->isValid(), "Doesnt allow child on parents disallowing all children");
$classB->ParentID = $classCext->ID;
- $valid = $classB->doValidate();
+ $valid = $classB->validate();
$this->assertTrue($valid->isValid(), "Extensions of allowed classes are incorrectly reported as invalid");
$classCext->ParentID = $classD->ID;
- $valid = $classCext->doValidate();
+ $valid = $classCext->validate();
$this->assertFalse($valid->isValid(), "Doesnt allow child where only parent class is allowed on parent node, and asterisk prefixing is used");
}
@@ -1655,7 +1656,7 @@ public function testGetControllerName()
*/
public function testGetControllerNameFromConfig()
{
- Config::inst()->update(Page::class, 'controller_name', 'This\\Is\\A\\New\\Controller');
+ Config::inst()->set(Page::class, 'controller_name', 'This\\Is\\A\\New\\Controller');
$class = new Page;
$this->assertSame('This\\Is\\A\\New\\Controller', $class->getControllerName());
}
@@ -1665,7 +1666,7 @@ public function testGetControllerNameFromConfig()
*/
public function testGetControllerNameFromNamespaceMappingConfig()
{
- Config::inst()->update(SiteTree::class, 'namespace_mapping', [
+ Config::inst()->merge(SiteTree::class, 'namespace_mapping', [
'SilverStripe\\CMS\\Tests\\Page' => 'SilverStripe\\CMS\\Tests\\Controllers',
]);
@@ -1678,6 +1679,9 @@ public function testGetControllerNameFromNamespaceMappingConfig()
*/
public function testGetControllerNameWithUnderscoresIsSupported()
{
+ if (Deprecation::isEnabled()) {
+ $this->markTestSkipped('Test calls deprecated code');
+ }
$class = new SiteTreeTest_LegacyControllerName;
$this->assertEquals(SiteTreeTest_LegacyControllerName_Controller::class, $class->getControllerName());
}
diff --git a/tests/php/Model/VirtualPageTest.php b/tests/php/Model/VirtualPageTest.php
index b4ee7ba550..39086e310c 100644
--- a/tests/php/Model/VirtualPageTest.php
+++ b/tests/php/Model/VirtualPageTest.php
@@ -412,11 +412,11 @@ public function testAllowedChildrenLimitedOnVirtualPages()
$classCVirtual->write();
$classBVirtual->ParentID = $classA->ID;
- $valid = $classBVirtual->doValidate();
+ $valid = $classBVirtual->validate();
$this->assertTrue($valid->isValid(), "Does allow child linked to virtual page type allowed by parent");
$classCVirtual->ParentID = $classA->ID;
- $valid = $classCVirtual->doValidate();
+ $valid = $classCVirtual->validate();
$this->assertFalse($valid->isValid(), "Doesn't allow child linked to virtual page type disallowed by parent");
}
diff --git a/tests/php/Search/SearchFormTest.php b/tests/php/Search/ZZZSearchFormTest.php
similarity index 99%
rename from tests/php/Search/SearchFormTest.php
rename to tests/php/Search/ZZZSearchFormTest.php
index 3f8653abb6..e278de4bc7 100644
--- a/tests/php/Search/SearchFormTest.php
+++ b/tests/php/Search/ZZZSearchFormTest.php
@@ -30,7 +30,7 @@
class ZZZSearchFormTest extends FunctionalTest
{
- protected static $fixture_file = 'SearchFormTest.yml';
+ protected static $fixture_file = 'ZZZSearchFormTest.yml';
protected static $illegal_extensions = [
SiteTree::class => [
diff --git a/tests/php/Search/SearchFormTest.yml b/tests/php/Search/ZZZSearchFormTest.yml
similarity index 100%
rename from tests/php/Search/SearchFormTest.yml
rename to tests/php/Search/ZZZSearchFormTest.yml
diff --git a/tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php b/tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php
index 12f92ccdc7..2b3fdc75fe 100644
--- a/tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php
+++ b/tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php
@@ -12,8 +12,6 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
{
protected static $fixture_file = 'MigrateSiteTreeLinkingTaskTest.yml';
- protected static $use_draft_site = true;
-
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();