Merge pull request #492 from creative-commoners/pulls/2/depr-messages

API Update deprecations
This commit is contained in:
Guy Sartorelli 2022-11-21 09:56:31 +13:00 committed by GitHub
commit ceaa915b77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Subsites\Extensions; namespace SilverStripe\Subsites\Extensions;
use SilverStripe\Dev\Deprecation;
use Page; use Page;
use SilverStripe\CMS\Forms\SiteTreeURLSegmentField; use SilverStripe\CMS\Forms\SiteTreeURLSegmentField;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
@ -266,11 +267,12 @@ class SiteTreeSubsites extends DataExtension
* It may be that some relations are not diostinct to sub site so can stay * It may be that some relations are not diostinct to sub site so can stay
* whereas others may need to be duplicated * whereas others may need to be duplicated
* *
* @deprecated 2.2..3.0 Use the "cascade_duplicates" config API instead * @deprecated 2.2.0 Use the "cascade_duplicates" config API instead
* @param SiteTree $originalPage * @param SiteTree $originalPage
*/ */
public function duplicateSubsiteRelations($originalPage) public function duplicateSubsiteRelations($originalPage)
{ {
Deprecation::notice('2.2.0', 'Use the "cascade_duplicates" config API instead');
$thisClass = $originalPage->ClassName; $thisClass = $originalPage->ClassName;
$relations = Config::inst()->get($thisClass, 'duplicate_to_subsite_relations'); $relations = Config::inst()->get($thisClass, 'duplicate_to_subsite_relations');
@ -444,13 +446,14 @@ class SiteTreeSubsites extends DataExtension
* This function is marked as deprecated for removal in 5.0.0 in silverstripe/cms * This function is marked as deprecated for removal in 5.0.0 in silverstripe/cms
* so now simply passes execution to where the functionality exists for backwards compatiblity. * so now simply passes execution to where the functionality exists for backwards compatiblity.
* CMS 4.0.0 SiteTree already throws a SilverStripe deprecation error before calling this function. * CMS 4.0.0 SiteTree already throws a SilverStripe deprecation error before calling this function.
* @deprecated 2.2...3.0 use updatePreviewLink instead * @deprecated 2.2.0 Use updatePreviewLink() instead
* *
* @param string|null $action * @param string|null $action
* @return string * @return string
*/ */
public function alternatePreviewLink($action = null) public function alternatePreviewLink($action = null)
{ {
Deprecation::notice('2.2.0', 'Use updatePreviewLink() instead');
$link = ''; $link = '';
return $this->updatePreviewLink($link, $action); return $this->updatePreviewLink($link, $action);
} }

View File

@ -56,7 +56,7 @@ class Subsite extends DataObject
* Allows you to force a specific subsite ID, or comma separated list of IDs. * Allows you to force a specific subsite ID, or comma separated list of IDs.
* Only works for reading. An object cannot be written to more than 1 subsite. * Only works for reading. An object cannot be written to more than 1 subsite.
* *
* @deprecated 2.0.0..3.0.0 Use SubsiteState::singleton()->withState() instead. * @deprecated 2.0.0 Use SubsiteState::singleton()->withState() instead.
*/ */
public static $force_subsite = null; public static $force_subsite = null;
@ -201,11 +201,11 @@ class Subsite extends DataObject
* *
* @return int ID of the current subsite instance * @return int ID of the current subsite instance
* *
* @deprecated 2.0..3.0 Use SubsiteState::singleton()->getSubsiteId() instead * @deprecated 2.0.0 Use SubsiteState::singleton()->getSubsiteId() instead
*/ */
public static function currentSubsiteID() public static function currentSubsiteID()
{ {
Deprecation::notice('3.0', 'Use SubsiteState::singleton()->getSubsiteId() instead'); Deprecation::notice('2.0.0', 'Use SubsiteState::singleton()->getSubsiteId() instead');
return SubsiteState::singleton()->getSubsiteId(); return SubsiteState::singleton()->getSubsiteId();
} }