Merge branch '4' into 5

This commit is contained in:
Sabina Talipova 2022-11-21 16:59:42 +13:00
commit 2d10a624b3
15 changed files with 54 additions and 32 deletions

View File

@ -36,10 +36,10 @@ $.entwine('ss', function($){
onadd: function() {
var self = this;
// See SelectionGroup.js for logic which hides / shows ParentID
this.find('#Form_AddForm_ParentID_Holder .TreeDropdownField').bind('change', function() {
this.find('#Form_AddForm_ParentID_Holder .TreeDropdownField').on('change', function() {
self.updateTypeList();
});
this.find(".SelectionGroup.parent-mode").bind('change', function() {
this.find(".SelectionGroup.parent-mode").on('change', function() {
self.updateTypeList();
});
if ($(".cms-add-form .parent-mode :input").val() == 'top') {

View File

@ -36,7 +36,7 @@ $.entwine('ss', function($){
if (urlSegmentInput.length > 0) {
self._addActions();
this.bind('change', function(e) {
this.on('change', function(e) {
var origTitle = self.data('OrigVal');
var title = self.val();
self.data('OrigVal', title);
@ -154,8 +154,8 @@ $.entwine('ss', function($){
// Constructor: onmatch
onmatch : function() {
var self = this;
this.find(':input[name=ParentType]').bind('click', function(e) {self._toggleSelection(e);});
this.find('.TreeDropdownField').bind('change', function(e) {self._changeParentId(e);});
this.find(':input[name=ParentType]').on('click', function(e) {self._toggleSelection(e);});
this.find('.TreeDropdownField').on('change', function(e) {self._changeParentId(e);});
this._changeParentId();
this._toggleSelection();

View File

@ -2,6 +2,7 @@
namespace SilverStripe\CMS\Controllers;
use SilverStripe\Dev\Deprecation;
use InvalidArgumentException;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Admin\AdminRootController;
@ -74,6 +75,7 @@ use SilverStripe\VersionedAdmin\Controllers\CMSPageHistoryViewerController;
use SilverStripe\View\ArrayData;
use SilverStripe\View\Requirements;
use Translatable;
use SilverStripe\VersionedAdmin\Controllers\CMSPageHistoryViewerController;
/**
* The main "content" area of the CMS.
@ -2148,10 +2150,17 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
}
/**
<<<<<<< HEAD
* @deprecated 5.0 Please use custom logic for this
=======
* @deprecated 4.12.0 Use custom logic instead
* @param $request
* @return HTTPResponse|string|void
>>>>>>> 4
*/
public function publishall(HTTPRequest $request): HTTPResponse
{
Deprecation::notice('4.12.0', 'Use custom logic instead');
if (!Permission::check('ADMIN')) {
return Security::permissionFailure($this);
}

View File

@ -2755,7 +2755,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
}
/**
* @deprecated 5.0 use creatableChildPages instead
* @deprecated 4.12.0 Use creatableChildPages() instead
*
* Gets a list of the page types that can be created under this specific page
*
@ -2763,6 +2763,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
*/
public function creatableChildren()
{
Deprecation::notice('4.12.0', 'Use creatableChildPages() instead');
// Build the list of candidate children
$cache = SiteTree::singleton()->getCreatableChildrenCache();
$cacheKey = $this->generateChildrenCacheKey(Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0);

View File

@ -2,12 +2,13 @@
namespace SilverStripe\CMS\Model;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Assets\File;
use SilverStripe\ORM\DataExtension;
use SilverStripe\View\SSViewer;
/**
* @deprecated 4.2..5.0 Link tracking is baked into File class now
* @deprecated 4.2.0 Use FileLinkTracking instead
* @property File $owner
*/
class SiteTreeFileExtension extends DataExtension
@ -21,6 +22,11 @@ class SiteTreeFileExtension extends DataExtension
*
* @return string
*/
public function __construct()
{
Deprecation::notice('4.2.0', 'Use FileLinkTracking instead', Deprecation::SCOPE_CLASS);
}
public function BackLinkHTMLList()
{
$viewer = SSViewer::create(['type' => 'Includes', self::class . '_description']);

View File

@ -12,25 +12,32 @@ use SilverStripe\Admin\Forms\UsedOnTable;
use SilverStripe\Versioned\RecursivePublishable;
/**
* @deprecated 5.0
* No longer required - superceded by {@see UsedOnTable}
* @deprecated 4.12.0 Use UsedOnTable instead
*
* Extension applied to {@see FileFormFactory} to decorate with a "Used on:" information area.
* Uses tracking provided by {@see SiteTreeFileExtension} to generate this.
*
* @property File $owner
* @deprecated 4.12.0 Use UsedOnTable instead
*/
class SiteTreeFileFormFactoryExtension extends DataExtension
{
public function __construct()
{
Deprecation::notice('4.12.0', 'Use UsedOnTable instead', Deprecation::SCOPE_CLASS);
}
/**
* @deprecated 4.12.0 Use UsedOnTable instead
*/
public function updateFormFields(FieldList $fields, $controller, $formName, $context)
{
Deprecation::notice('4.12.0', 'Use UsedOnTable instead');
/** @var TabSet $tabset */
$tabset = $fields->fieldByName('Editor');
if (!$tabset) {
return;
}
$class = UsedOnTable::class;
Deprecation::notice('5.0', "Use the $class to show this table");
$usedOnField = UsedOnTable::create('UsedOnTableReplacement');
$usedOnField->setRecord($context['Record']);

View File

@ -15,26 +15,26 @@ use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject;
/**
* @deprecated 4.2..5.0 Will be removed in cms 5.0
* @deprecated 4.2.0 Will be removed without equivalent functionality to replace it
*/
class SiteTreeFolderExtension extends DataExtension
{
public function __construct()
{
Deprecation::notice('4.2.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
parent::__construct();
Deprecation::notice('5.0', 'Will be removed in 5.0');
}
/**
* Looks for files used in system and create where clause which contains all ID's of files.
*
* @deprecated 4.2..5.0
* @deprecated 4.2.0 Will be removed without equivalent functionality to replace it
* @returns string where clause which will work as filter.
*/
public function getUnusedFilesListFilter()
{
Deprecation::notice('5.0', 'Will be removed in 5.0');
Deprecation::notice('4.2.0', 'Will be removed without equivalent functionality to replace it');
// Add all records in link tracking
$usedFiles = FileLink::get()->column('LinkedID');

View File

@ -361,11 +361,11 @@ class VirtualPage extends Page
}
/**
* @deprecated 4.2..5.0
* @deprecated 4.2.0 Will be removed without equivalent functionality to replace it
*/
public function updateImageTracking()
{
Deprecation::notice('5.0', 'This will be removed in 5.0');
Deprecation::notice('4.2.0', 'Will be removed without equivalent functionality to replace it');
// Doesn't work on unsaved records
if (!$this->isInDB()) {

View File

@ -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 %><a href="$Link" class="breadcrumb-$Pos"><% end_if %>$MenuTitle.XML<% if not Up.Unlinked %></a><% end_if %> $Up.Delimiter.RAW <% end_if %><% end_loop %>
<% loop $Pages %><% if $IsLast %>$MenuTitle.XML<% else %><% if not Up.Unlinked %><a href="$Link" class="breadcrumb-$Pos"><% end_if %>$MenuTitle.XML<% if not Up.Unlinked %></a><% end_if %> $Up.Delimiter.RAW <% end_if %><% end_loop %>
<% end_if %>

View File

@ -25,7 +25,7 @@ class CMSBatchActionsTest extends SapphireTest
$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');

View File

@ -33,7 +33,7 @@ class RedirectorPageTest extends FunctionalTest
$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 SiteTree $page */

View File

@ -41,6 +41,7 @@ use Page;
use PageController;
use const RESOURCES_DIR;
use SilverStripe\Dev\Deprecation;
class SiteTreeTest extends SapphireTest
{
@ -442,7 +443,7 @@ class SiteTreeTest extends SapphireTest
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();
@ -1306,23 +1307,23 @@ class SiteTreeTest extends SapphireTest
$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;
@ -1722,7 +1723,7 @@ class SiteTreeTest extends SapphireTest
*/
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',
]);

View File

@ -411,11 +411,11 @@ class VirtualPageTest extends FunctionalTest
$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");
}

View File

@ -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();