Skip to content

Commit

Permalink
Merge pull request #2791 from creative-commoners/pulls/4/deprecated
Browse files Browse the repository at this point in the history
API Update deprecations
  • Loading branch information
GuySartorelli authored Oct 24, 2022
2 parents efe0858 + e637740 commit d0f49d1
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 14 deletions.
4 changes: 3 additions & 1 deletion code/Controllers/CMSMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\CMS\Controllers;

use SilverStripe\Dev\Deprecation;
use InvalidArgumentException;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Admin\AdminRootController;
Expand Down Expand Up @@ -2163,12 +2164,13 @@ public function BatchActionList()
}

/**
* @deprecated 5.0 Please use custom logic for this
* @deprecated 4.12.0 Use custom logic instead
* @param $request
* @return HTTPResponse|string|void
*/
public function publishall($request)
{
Deprecation::notice('4.12.0', 'Use custom logic instead');
if (!Permission::check('ADMIN')) {
return Security::permissionFailure($this);
}
Expand Down
9 changes: 8 additions & 1 deletion code/Controllers/CMSPageHistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\CMS\Controllers;

use SilverStripe\Dev\Deprecation;
use SilverStripe\Admin\LeftAndMainFormRequestHandler;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
Expand All @@ -24,7 +25,7 @@
/**
* Legacy CMS History controller. This functionality has been moved to the `silverstripe/versioned-admin` module and
* this class will be removed completly in SilverStripe 5.0.0.
* @deprecated 4.3.0:5.0.0
* @deprecated 4.3.0 Use silverstripe/versioned-admin instead
*/
class CMSPageHistoryController extends CMSMain
{
Expand Down Expand Up @@ -59,6 +60,12 @@ class CMSPageHistoryController extends CMSMain
*/
protected $versionID = null;

public function __construct()
{
parent::__construct();
Deprecation::notice('4.3.0', 'Use silverstripe/versioned-admin instead', Deprecation::SCOPE_CLASS);
}

public function getResponseNegotiator()
{
$negotiator = parent::getResponseNegotiator();
Expand Down
3 changes: 2 additions & 1 deletion code/Model/SiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -2751,14 +2751,15 @@ public function allowedChildren()
}

/**
* @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
*
* @return array
*/
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);
Expand Down
8 changes: 7 additions & 1 deletion code/Model/SiteTreeFileExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']);
Expand Down
17 changes: 13 additions & 4 deletions code/Model/SiteTreeFileFormFactoryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
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.
Expand All @@ -22,15 +21,25 @@
*/
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);
}

/**
* @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']);
Expand Down
8 changes: 4 additions & 4 deletions code/Model/SiteTreeFolderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
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');
Expand Down
4 changes: 2 additions & 2 deletions code/Model/VirtualPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ public function validate()
}

/**
* @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()) {
Expand Down

0 comments on commit d0f49d1

Please sign in to comment.