Skip to content

Commit

Permalink
API Update deprecations (#523)
Browse files Browse the repository at this point in the history
* ENH Update deprecation messages

* API Update deprecations
  • Loading branch information
emteknetnz authored Oct 25, 2022
1 parent fffce6e commit aeca7ea
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 125 deletions.
10 changes: 2 additions & 8 deletions src/Dev/FixFolderPermissionsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* This helper class resets the `CanViewType` of files that are `NULL`.
* You need to flush your cache after running this via CLI.
*
* @deprecated 1.12.0 FixFolderPermissionsHelper will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class FixFolderPermissionsHelper
{
Expand All @@ -34,12 +33,7 @@ class FixFolderPermissionsHelper

public function __construct()
{
Deprecation::notice(
'1.12.0',
'FixFolderPermissionsHelper will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
$this->logger = new NullLogger();
}

Expand Down
13 changes: 4 additions & 9 deletions src/Dev/Tasks/FileMigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
*
* This service does not alter these records in such a way that prevents downgrading back to 3.x
*
* @deprecated 1.12.0 FileMigrationHelper will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class FileMigrationHelper
{
Expand Down Expand Up @@ -63,12 +62,7 @@ class FileMigrationHelper

public function __construct()
{
Deprecation::notice(
'1.12.0',
'FileMigrationHelper will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
$this->logger = new NullLogger();
}

Expand Down Expand Up @@ -556,11 +550,12 @@ private function chunk(DataList $query)
/**
* Get map of File IDs to legacy filenames
*
* @deprecated 4.4.0
* @deprecated 1.4.0 Will be removed without equivalent functionality to replace it
* @return array
*/
protected function getFilenameArray()
{
Deprecation::notice('1.4.0', 'Will be removed without equivalent functionality to replace it');
$table = DataObject::singleton(File::class)->baseTable();
// Convert original query, ensuring the legacy "Filename" is included in the result
/** @skipUpgrade */
Expand Down
10 changes: 2 additions & 8 deletions src/Dev/Tasks/FolderMigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
*
* This service does not alter these records in such a way that prevents downgrading back to 3.x
*
* @deprecated 1.12.0 FolderMigrationHelper will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*
*/
class FolderMigrationHelper
Expand All @@ -41,12 +40,7 @@ class FolderMigrationHelper

public function __construct()
{
Deprecation::notice(
'1.12.0',
'FolderMigrationHelper will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
$this->logger = new NullLogger();
}

Expand Down
10 changes: 2 additions & 8 deletions src/Dev/Tasks/LegacyThumbnailMigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
* - Does not filter out unused CMS thumbnails (they're using a new size now)
* - Does not move legacy thumbnails to the protected store if the original file
* has been unpublished or protected since an earlier 4.x migration run
* @deprecated 1.12.0 LegacyThumbnailMigrationHelper will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class LegacyThumbnailMigrationHelper
{
Expand All @@ -55,12 +54,7 @@ class LegacyThumbnailMigrationHelper

public function __construct()
{
Deprecation::notice(
'1.12.0',
'LegacyThumbnailMigrationHelper will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
$this->logger = new NullLogger();
}

Expand Down
10 changes: 2 additions & 8 deletions src/Dev/Tasks/NormaliseAccessMigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
*
* This is meant to correct files that got save to the wrong location following the CVE-2019-12245 vulnerability.
*
* @deprecated 1.12.0 NormaliseAccessMigrationHelper will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class NormaliseAccessMigrationHelper
{
Expand Down Expand Up @@ -92,12 +91,7 @@ class NormaliseAccessMigrationHelper
*/
public function __construct($base = '')
{
Deprecation::notice(
'1.12.0',
'NormaliseAccessMigrationHelper will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
$this->logger = new NullLogger();
if ($base) {
$this->basePath = $base;
Expand Down
10 changes: 2 additions & 8 deletions src/Dev/Tasks/SecureAssetsMigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
*
* See https://github.com/silverstripe/silverstripe-assets/issues/231
*
* @deprecated 1.12.0 SecureAssetsMigrationHelper will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class SecureAssetsMigrationHelper
{
Expand All @@ -50,12 +49,7 @@ class SecureAssetsMigrationHelper

public function __construct()
{
Deprecation::notice(
'1.12.0',
'SecureAssetsMigrationHelper will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);

$this->logger = new NullLogger();

Expand Down
10 changes: 2 additions & 8 deletions src/Dev/Tasks/TagsToShortcodeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
* SS4 and its File Migration Task changes the way in which files are stored in the assets folder, with files placed
* in subfolders named with partial hashmap values of the file version. This helper class goes through the HTML content
* fields looking for instances of image links, and corrects the link path to what it should be, with an image shortcode.
* @deprecated 1.12.0 TagsToShortcodeHelper will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class TagsToShortcodeHelper
{
Expand Down Expand Up @@ -87,12 +86,7 @@ public function setLogger(LoggerInterface $logger)
*/
public function __construct($baseClass = null, $includeBaseClass = false)
{
Deprecation::notice(
'1.12.0',
'TagsToShortcodeHelper will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
$flysystemAssetStore = singleton(AssetStore::class);
if (!($flysystemAssetStore instanceof FlysystemAssetStore)) {
throw new InvalidArgumentException("FlysystemAssetStore missing");
Expand Down
10 changes: 2 additions & 8 deletions src/Dev/Tasks/TagsToShortcodeTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
* SS4 and its File Migration Task changes the way in which files are stored in the assets folder, with files placed
* in subfolders named with partial hashmap values of the file version. This build task goes through the HTML content
* fields looking for instances of image links, and corrects the link path to what it should be, with an image shortcode.
* @deprecated 1.12.0 TagsToShortcodeTask will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class TagsToShortcodeTask extends BuildTask
{
Expand All @@ -30,12 +29,7 @@ class TagsToShortcodeTask extends BuildTask

public function __construct()
{
Deprecation::notice(
'1.12.0',
'TagsToShortcodeTask will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
parent::__construct();
}

Expand Down
10 changes: 2 additions & 8 deletions src/Dev/Tasks/VersionedFilesMigrationTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
use SilverStripe\Dev\Deprecation;

/**
* @deprecated 1.12.0 VersionedFilesMigrationTask will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class VersionedFilesMigrationTask extends BuildTask
{
Expand All @@ -27,12 +26,7 @@ class VersionedFilesMigrationTask extends BuildTask

public function __construct()
{
Deprecation::notice(
'1.12.0',
'VersionedFilesMigrationTask will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
parent::__construct();
}

Expand Down
10 changes: 2 additions & 8 deletions src/Dev/VersionedFilesMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
use Symfony\Component\Finder\Finder;

/**
* @deprecated 1.12.0 VersionedFilesMigrator will not be needed in
* Silverstripe CMS 5. Run the task prior to upgrading your project.
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
class VersionedFilesMigrator
{
Expand Down Expand Up @@ -63,12 +62,7 @@ class VersionedFilesMigrator
*/
public function __construct($strategy = self::STRATEGY_DELETE, $basePath = ASSETS_DIR, $output = true)
{
Deprecation::notice(
'1.12.0',
'VersionedFilesMigrator will not be needed in Silverstripe CMS 5. ' .
'Run the task prior to upgrading your project.',
Deprecation::SCOPE_CLASS
);
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);

if (!in_array($strategy, [self::STRATEGY_DELETE, self::STRATEGY_PROTECT])) {
throw new InvalidArgumentException(sprintf(
Expand Down
8 changes: 4 additions & 4 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ public function Link()
}

/**
* @deprecated 4.0
* @deprecated 1.0.0 Use getURL() instead
*/
public function RelativeLink()
{
Deprecation::notice('4.0', 'Use getURL instead, as not all files will be relative to the site root.');
Deprecation::notice('1.0.0', 'Use getURL() instead');
return Director::makeRelative($this->getURL());
}

Expand Down Expand Up @@ -1115,13 +1115,13 @@ public static function format_size($size)
/**
* Convert a php.ini value (eg: 512M) to bytes
*
* @deprecated 5.0 Use Convert::memstring2bytes() instead
* @deprecated 1.12.0 Use Convert::memstring2bytes() instead
* @param string $iniValue
* @return int
*/
public static function ini2bytes($iniValue)
{
Deprecation::notice('5.0', 'Use Convert::memstring2bytes instead');
Deprecation::notice('1.12.0', 'Use Convert::memstring2bytes() instead');
return Convert::memstring2bytes($iniValue);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ public static function remove_folder_if_empty($folder, $recursive = true)
/**
* Cleanup function to reset all the Filename fields. Visit File/fixfiles to call.
*
* @deprecated 5.0
* @deprecated 1.12.0 Will be removed without equivalent functionality to replace it
*/
public function fixfiles()
{
Deprecation::notice('5.0');
Deprecation::notice('1.12.0', 'Will be removed without equivalent functionality to replace it');
if (!Permission::check('ADMIN')) {
return Security::permissionFailure($this);
}
Expand Down
Loading

0 comments on commit aeca7ea

Please sign in to comment.