From 55b17c920cdb45e821e3bbb16614392e5a5abba2 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 18 Oct 2022 15:23:59 +1300 Subject: [PATCH] API Update deprecations --- code/Controllers/CMSMain.php | 4 +++- code/Controllers/CMSPageHistoryController.php | 8 +++++++- code/Model/SiteTree.php | 3 ++- code/Model/SiteTreeFileExtension.php | 8 +++++++- code/Model/SiteTreeFileFormFactoryExtension.php | 15 +++++++++++++-- code/Model/SiteTreeFolderExtension.php | 8 ++++---- code/Model/VirtualPage.php | 4 ++-- 7 files changed, 38 insertions(+), 12 deletions(-) diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index 64367236..424e9eb1 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -2,6 +2,7 @@ namespace SilverStripe\CMS\Controllers; +use SilverStripe\Dev\Deprecation; use InvalidArgumentException; use Psr\SimpleCache\CacheInterface; use SilverStripe\Admin\AdminRootController; @@ -2163,12 +2164,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr } /** - * @deprecated 5.0 Use custom logic instead + * @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); } diff --git a/code/Controllers/CMSPageHistoryController.php b/code/Controllers/CMSPageHistoryController.php index 5a12f8c6..48a8ae35 100644 --- a/code/Controllers/CMSPageHistoryController.php +++ b/code/Controllers/CMSPageHistoryController.php @@ -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; @@ -24,7 +25,7 @@ use SilverStripe\View\ViewableData; /** * 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 Use silverstripe/versioned-admin instead + * @deprecated 4.3.0 Use silverstripe/versioned-admin instead */ class CMSPageHistoryController extends CMSMain { @@ -59,6 +60,11 @@ class CMSPageHistoryController extends CMSMain */ protected $versionID = null; + public function __construct() + { + Deprecation::notice('4.3.0', 'Use silverstripe/versioned-admin instead', Deprecation::SCOPE_CLASS); + } + public function getResponseNegotiator() { $negotiator = parent::getResponseNegotiator(); diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index 1206dcec..b15cbdbf 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -2751,7 +2751,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 * @@ -2759,6 +2759,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); diff --git a/code/Model/SiteTreeFileExtension.php b/code/Model/SiteTreeFileExtension.php index 2b554513..5cbd7d53 100644 --- a/code/Model/SiteTreeFileExtension.php +++ b/code/Model/SiteTreeFileExtension.php @@ -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 Use FileLinkTracking instead + * @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']); diff --git a/code/Model/SiteTreeFileFormFactoryExtension.php b/code/Model/SiteTreeFileFormFactoryExtension.php index b3d39a0f..e20c95ec 100644 --- a/code/Model/SiteTreeFileFormFactoryExtension.php +++ b/code/Model/SiteTreeFileFormFactoryExtension.php @@ -12,7 +12,7 @@ use SilverStripe\Admin\Forms\UsedOnTable; use SilverStripe\Versioned\RecursivePublishable; /** - * @deprecated 5.0 Use UsedOnTable instead + * @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. @@ -21,14 +21,25 @@ use SilverStripe\Versioned\RecursivePublishable; */ 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; } - Deprecation::notice('5.0', "Use UsedOnTable instead"); $usedOnField = UsedOnTable::create('UsedOnTableReplacement'); $usedOnField->setRecord($context['Record']); diff --git a/code/Model/SiteTreeFolderExtension.php b/code/Model/SiteTreeFolderExtension.php index 35a990cd..08f53f9e 100644 --- a/code/Model/SiteTreeFolderExtension.php +++ b/code/Model/SiteTreeFolderExtension.php @@ -15,26 +15,26 @@ use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; /** - * @deprecated 4.2..5.0 Will be removed without equivalent functionality to replace it + * @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 Will be removed without equivalent functionality to replace it + * @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'); diff --git a/code/Model/VirtualPage.php b/code/Model/VirtualPage.php index e377c924..9d0573c2 100644 --- a/code/Model/VirtualPage.php +++ b/code/Model/VirtualPage.php @@ -361,11 +361,11 @@ class VirtualPage extends Page } /** - * @deprecated 4.2..5.0 Will be removed without equivalent functionality to replace it + * @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()) {