API Update deprecations

This commit is contained in:
Steve Boyd 2022-10-13 14:49:15 +13:00
parent 33b6a00f49
commit 9c453abf89
58 changed files with 259 additions and 187 deletions

View File

@ -533,14 +533,11 @@ class Controller extends RequestHandler implements TemplateGlobalProvider
* called before Controller::init(). That is, you must call it in your controller's init method
* before it calls parent::init().
*
* @deprecated 4.1.0:5.0.0 Add this controller's url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead
* @deprecated 4.1.0 Add this controller's url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead
*/
public function disableBasicAuth()
{
Deprecation::notice(
'5.0',
'Add this controller\'s url to ' . BasicAuthMiddleware::class . '.URLPatterns injected property instead'
);
Deprecation::notice('4.1.0', 'Add this controller\'s url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead');
$this->basicAuthEnabled = false;
}

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Control;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\FieldType\DBDatetime;
use LogicException;
@ -200,10 +201,11 @@ class CookieJar implements Cookie_Backend
/**
* Get the correct samesite value - Session cookies use a different configuration variable.
*
* @deprecated 5.0 The relevant methods will include a `$sameSite` parameter instead.
* @deprecated 4.12.0 The relevant methods will include a `$sameSite` parameter instead.
*/
private function getSameSite(string $name): string
{
Deprecation::notice('4.12.0', 'The relevant methods will include a `$sameSite` parameter instead.');
if ($name === session_name()) {
return Session::config()->get('cookie_samesite');
}

View File

@ -386,10 +386,11 @@ class Director implements TemplateGlobalProvider
*
* @return bool
*
* @deprecated 5.0 Use Kernel::isFlushed instead
* @deprecated 4.12.0 Use Kernel::isFlushed instead
*/
public static function isManifestFlushed()
{
Deprecation::notice('4.12.0', 'Use Kernel::isFlushed instead');
$kernel = Injector::inst()->get(Kernel::class);
// Only CoreKernel implements this method at the moment

View File

@ -737,7 +737,7 @@ class Email extends ViewableData
}
/**
* @deprecated Will be removed without equivalent functionality to replace it
* @deprecated 4.12.0 Will be removed without equivalent functionality to replace it
*
* Debugging help
*

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Control\Email;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Injector\Injector;
@ -37,6 +38,11 @@ class SwiftMailer implements Mailer
* @param Email $message
* @return bool Whether the sending was "successful" or not
*/
public function __construct()
{
Deprecation::notice('4.12.0', 'Will be replaced with symfony/mailer', Deprecation::SCOPE_CLASS);
}
public function send($message)
{
$swiftMessage = $message->getSwiftMessage();

View File

@ -372,43 +372,43 @@ class HTTP
/**
* Set the maximum age of this page in web caches, in seconds.
*
* @deprecated 4.2.0:5.0.0 Use HTTPCacheControlMiddleware::singleton()->setMaxAge($age) instead
* @deprecated 4.2.0 Use HTTPCacheControlMiddleware::singleton()->setMaxAge($age) instead
* @param int $age
*/
public static function set_cache_age($age)
{
Deprecation::notice('5.0', 'Use HTTPCacheControlMiddleware::singleton()->setMaxAge($age) instead');
Deprecation::notice('4.2.0', 'Use HTTPCacheControlMiddleware::singleton()->setMaxAge($age) instead');
self::$cache_age = $age;
HTTPCacheControlMiddleware::singleton()->setMaxAge($age);
}
/**
* @param string $dateString
* @deprecated 4.2.0:5.0.0 Use HTTPCacheControlMiddleware::registerModificationDate() instead
* @deprecated 4.2.0 Use HTTPCacheControlMiddleware::registerModificationDate() instead
*/
public static function register_modification_date($dateString)
{
Deprecation::notice('5.0', 'Use HTTPCacheControlMiddleware::registerModificationDate() instead');
Deprecation::notice('4.2.0', 'Use HTTPCacheControlMiddleware::registerModificationDate() instead');
HTTPCacheControlMiddleware::singleton()->registerModificationDate($dateString);
}
/**
* @param int $timestamp
* @deprecated 4.2.0:5.0.0 Use HTTPCacheControlMiddleware::registerModificationDate() instead
* @deprecated 4.2.0 Use HTTPCacheControlMiddleware::registerModificationDate() instead
*/
public static function register_modification_timestamp($timestamp)
{
Deprecation::notice('5.0', 'Use HTTPCacheControlMiddleware::registerModificationDate() instead');
Deprecation::notice('4.2.0', 'Use HTTPCacheControlMiddleware::registerModificationDate() instead');
HTTPCacheControlMiddleware::singleton()->registerModificationDate($timestamp);
}
/**
* @deprecated 4.2.0:5.0.0 Use ChangeDetectionMiddleware instead
* @deprecated 4.2.0 Use ChangeDetectionMiddleware instead
* @param string $etag
*/
public static function register_etag($etag)
{
Deprecation::notice('5.0', 'Use ChangeDetectionMiddleware instead');
Deprecation::notice('4.2.0', 'Use ChangeDetectionMiddleware instead');
if (strpos($etag ?? '', '"') !== 0) {
$etag = "\"{$etag}\"";
}
@ -426,11 +426,11 @@ class HTTP
* output directly.
*
* @param HTTPResponse $response
* @deprecated 4.2.0:5.0.0 Headers are added automatically by HTTPCacheControlMiddleware instead.
* @deprecated 4.2.0 Headers are added automatically by HTTPCacheControlMiddleware instead.
*/
public static function add_cache_headers($response = null)
{
Deprecation::notice('5.0', 'Headers are added automatically by HTTPCacheControlMiddleware instead.');
Deprecation::notice('4.2.0', 'Headers are added automatically by HTTPCacheControlMiddleware instead.');
// Skip if deprecated API is disabled
if (Config::inst()->get(HTTP::class, 'ignoreDeprecatedCaching')) {
@ -473,13 +473,14 @@ class HTTP
/**
* Ensure that all deprecated HTTP cache settings are respected
*
* @deprecated 4.2.0:5.0.0 Use HTTPCacheControlMiddleware instead
* @deprecated 4.2.0 Use HTTPCacheControlMiddleware instead
* @throws \LogicException
* @param HTTPRequest $request
* @param HTTPResponse $response
*/
public static function augmentState(HTTPRequest $request, HTTPResponse $response)
{
Deprecation::notice('4.2.0', 'Use HTTPCacheControlMiddleware instead');
// Skip if deprecated API is disabled
$config = Config::forClass(HTTP::class);
if ($config->get('ignoreDeprecatedCaching')) {
@ -560,11 +561,12 @@ class HTTP
* is always in GMT: the number of seconds since January 1 1970 00:00:00 GMT)
*
* @param int $timestamp
* @deprecated 4.2.0:5.0.0 Use native php function gmdate() instead
* @deprecated 4.2.0 Use native php function gmdate() instead
* @return string
*/
public static function gmt_date($timestamp)
{
Deprecation::notice('4.2.0', 'Use native php function gmdate() instead');
return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT';
}

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Control;
use SilverStripe\Dev\Deprecation;
use ArrayAccess;
use BadMethodCallException;
use InvalidArgumentException;
@ -914,6 +915,7 @@ class HTTPRequest implements ArrayAccess
*/
public static function detect_method($origMethod, $postVars)
{
Deprecation::notice('4.4.7', 'Will be removed without equivalent functionality');
if (isset($postVars['_method'])) {
if (!self::isValidHttpMethod($postVars['_method'])) {
throw new InvalidArgumentException('HTTPRequest::detect_method(): Invalid "_method" parameter');

View File

@ -9,7 +9,7 @@ use SilverStripe\Dev\Deprecation;
/**
* Middleware that provides back-support for the deprecated RequestFilter API.
*
* @deprecated 4.0.0:5.0.0 Use HTTPMiddleware directly instead.
* @deprecated 4.0.1 Use HTTPMiddleware directly instead.
*/
class RequestProcessor implements HTTPMiddleware
{
@ -29,6 +29,7 @@ class RequestProcessor implements HTTPMiddleware
*/
public function __construct($filters = [])
{
Deprecation::notice('4.0.1', 'Use HTTPMiddleware directly instead.', Deprecation::SCOPE_CLASS);
$this->filters = $filters;
}

View File

@ -586,13 +586,13 @@ class Session
* Recursively apply the changes represented in $data to $dest.
* Used to update $_SESSION
*
* @deprecated 4.1.0:5.0.0 Use recursivelyApplyChanges() instead
* @deprecated 4.1.0 Use recursivelyApplyChanges() instead
* @param array $data
* @param array $dest
*/
protected function recursivelyApply($data, &$dest)
{
Deprecation::notice('5.0', 'Use recursivelyApplyChanges() instead');
Deprecation::notice('4.1.0', 'Use recursivelyApplyChanges() instead');
foreach ($data as $k => $v) {
if (is_array($v)) {
if (!isset($dest[$k]) || !is_array($dest[$k])) {

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Control;
use SilverStripe\Dev\Deprecation;
use InvalidArgumentException;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert;
@ -159,12 +160,13 @@ class SimpleResourceURLGenerator implements ResourceURLGenerator
/**
* Resolve resource in the absence of a public/ folder
*
* @deprecated 4.1.0:5.0.0 Will be removed without equivalent functionality when public/ folder becomes mandatory
* @deprecated 4.1.0 Will be removed without equivalent functionality when public/ folder becomes mandatory
* @param string $relativePath
* @return array List of [$exists, $absolutePath, $relativePath]
*/
protected function resolveUnsecuredResource($relativePath)
{
Deprecation::notice('4.1.0', 'Will be removed without equivalent functionality when public/ folder becomes mandatory');
// Check if the path requested is public-only, but we have no public folder
$publicOnly = $this->inferPublicResourceRequired($relativePath);
if ($publicOnly) {

View File

@ -260,10 +260,11 @@ abstract class BaseKernel implements Kernel
*
* @return string
*
* @deprecated 5.0 use Director::get_environment_type() instead
* @deprecated 4.12.0 Use Director::get_environment_type() instead
*/
public function getEnvironment()
{
Deprecation::notice('4.12.0', 'Use Director::get_environment_type() instead');
// Check set
if ($this->enviroment) {
return $this->enviroment;
@ -288,10 +289,11 @@ abstract class BaseKernel implements Kernel
*
* @return null|string
*
* @deprecated 5.0 Use Director::get_session_environment_type() instead
* @deprecated 4.12.0 Use Director::get_session_environment_type() instead
*/
protected function sessionEnvironment()
{
Deprecation::notice('4.12.0', 'Use Director::get_session_environment_type() instead');
if (!$this->booted) {
// session is not initialyzed yet, neither is manifest
return null;
@ -378,11 +380,11 @@ abstract class BaseKernel implements Kernel
* The purpose of this method is to avoid loading PHPUnit test files with incompatible definitions.
*
* @return string[] List of CI types to ignore as defined by `Module`.
* @deprecated 5.0.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
protected function getIgnoredCIConfigs(): array
{
Deprecation::notice('5.0.0', 'This method will be removed in CMS 5');
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality');
return [];
}

View File

@ -156,13 +156,13 @@ class ClassInfo
}
/**
* @deprecated 4.0.0:5.0.0
* @deprecated 4.0.1 Use DataObject::getSchema()->baseDataClass()
* @param string $class
* @return string
*/
public static function baseDataClass($class)
{
Deprecation::notice('5.0', 'Use DataObject::getSchema()->baseDataClass()');
Deprecation::notice('4.0.1', 'Use DataObject::getSchema()->baseDataClass()');
return DataObject::getSchema()->baseDataClass($class);
}
@ -371,11 +371,11 @@ class ClassInfo
}
/**
* @deprecated 4.0.0:5.0.0
* @deprecated 4.0.1 Use DataObject::getSchema()->tableForField()
*/
public static function table_for_object_field($candidateClass, $fieldName)
{
Deprecation::notice('5.0', 'Use DataObject::getSchema()->tableForField()');
Deprecation::notice('4.0.1', 'Use DataObject::getSchema()->tableForField()');
return DataObject::getSchema()->tableForField($candidateClass, $fieldName);
}

View File

@ -43,10 +43,11 @@ class Config_ForClass
* @param string $name
* @param mixed $value
* @return $this
* @deprecated 4.12.0 Use merge() instead
*/
public function update($name, $value)
{
Deprecation::notice('5.0', 'Use merge() instead');
Deprecation::notice('4.12.0', 'Use merge() instead');
return $this->merge($name, $value);
}

View File

@ -161,14 +161,14 @@ class Convert
* Encode a value as a JSON encoded string. You can optionally pass a bitmask of
* JSON constants as options through to the encode function.
*
* @deprecated 4.4.0:5.0.0 Use json_encode() instead
* @deprecated 4.4.0 Use json_encode() instead
* @param mixed $val Value to be encoded
* @param int $options Optional bitmask of JSON constants
* @return string JSON encoded string
*/
public static function raw2json($val, $options = 0)
{
Deprecation::notice('4.4', 'Please use json_encode() instead.');
Deprecation::notice('4.4.0', 'Use json_encode() instead');
return json_encode($val, $options ?? 0);
}
@ -176,14 +176,14 @@ class Convert
/**
* Encode an array as a JSON encoded string.
*
* @deprecated 4.4.0:5.0.0 Use json_encode() instead
* @deprecated 4.4.0 Use json_encode() instead
* @param array $val Array to convert
* @param int $options Optional bitmask of JSON constants
* @return string JSON encoded string
*/
public static function array2json($val, $options = 0)
{
Deprecation::notice('4.4', 'Please use json_encode() instead.');
Deprecation::notice('4.4.0', 'Use json_encode() instead');
return json_encode($val, $options ?? 0);
}
@ -261,13 +261,13 @@ class Convert
/**
* Convert a JSON encoded string into an object.
*
* @deprecated 4.4.0:5.0.0 Use json_decode() instead
* @deprecated 4.4.0 Use json_decode() instead
* @param string $val
* @return object|boolean
*/
public static function json2obj($val)
{
Deprecation::notice('4.4', 'Please use json_decode() instead.');
Deprecation::notice('4.4.0', 'Use json_decode() instead');
return json_decode($val ?? '');
}
@ -275,13 +275,13 @@ class Convert
/**
* Convert a JSON string into an array.
*
* @deprecated 4.4.0:5.0.0 Use json_decode() instead
* @deprecated 4.4.0 Use json_decode() instead
* @param string $val JSON string to convert
* @return array|boolean
*/
public static function json2array($val)
{
Deprecation::notice('4.4', 'Please use json_decode() instead.');
Deprecation::notice('4.4.0', 'Use json_decode() instead');
return json_decode($val ?? '', true);
}
@ -295,13 +295,13 @@ class Convert
* @param boolean $disableDoctypes Disables the use of DOCTYPE, and will trigger an error if encountered.
* false by default.
* @param boolean $disableExternals Does nothing because xml entities are removed
* @deprecated 4.11.0:5.0.0
* @deprecated 4.11.0 Use a dedicated XML library instead
* @return array
* @throws Exception
*/
public static function xml2array($val, $disableDoctypes = false, $disableExternals = false)
{
Deprecation::notice('4.10', 'Use a dedicated XML library instead');
Deprecation::notice('4.11.0', 'Use a dedicated XML library instead');
// Check doctype
if ($disableDoctypes && strpos($val ?? '', '<!DOCTYPE') !== false) {

View File

@ -854,13 +854,13 @@ class Injector implements ContainerInterface
}
/**
* @deprecated 4.0.0:5.0.0 Use Injector::has() instead
* @deprecated 4.0.1 Use Injector::has() instead
* @param $name
* @return string
*/
public function hasService($name)
{
Deprecation::notice('5.0', 'Use Injector::has() instead');
Deprecation::notice('4.0.1', 'Use Injector::has() instead');
return $this->has($name);
}

View File

@ -142,10 +142,11 @@ class ClassLoader
*
* @param string $class
* @return bool
* @deprecated 4.0.1 Use ClassInfo::exists() instead
*/
public function classExists($class)
{
Deprecation::notice('4.0', 'Use ClassInfo::exists() instead');
Deprecation::notice('4.0.1', 'Use ClassInfo::exists() instead');
return ClassInfo::exists($class);
}
}

View File

@ -206,10 +206,11 @@ class Module implements Serializable
* The __serialize() magic method will be automatically used instead of this
*
* @return string
* @deprecated Use __serialize() instead
* @deprecated 4.12.0 Use __serialize() instead
*/
public function serialize()
{
Deprecation::notice('4.12.0', 'Use __serialize() instead');
return json_encode([$this->path, $this->basePath, $this->composerData]);
}
@ -219,10 +220,11 @@ class Module implements Serializable
* and the PHP version used in less than PHP 9.0
*
* @param string $serialized
* @deprecated Use __unserialize() instead
* @deprecated 4.12.0 Use __unserialize() instead
*/
public function unserialize($serialized)
{
Deprecation::notice('4.12.0', 'Use __unserialize() instead');
list($this->path, $this->basePath, $this->composerData) = json_decode($serialized ?? '', true);
$this->resources = [];
}
@ -275,52 +277,52 @@ class Module implements Serializable
}
/**
* @deprecated 4.0.0:5.0.0 Use getResource($path)->getRelativePath() instead
* @deprecated 4.0.1 Use getResource($path)->getRelativePath() instead
* @param string $path
* @return string
*/
public function getRelativeResourcePath($path)
{
Deprecation::notice('5.0', 'Use getResource($path)->getRelativePath() instead');
Deprecation::notice('4.0.1', 'Use getResource($path)->getRelativePath() instead');
return $this
->getResource($path)
->getRelativePath();
}
/**
* @deprecated 4.0.0:5.0.0 Use getResource($path)->getPath() instead
* @deprecated 4.0.1 Use getResource($path)->getPath() instead
* @param string $path
* @return string
*/
public function getResourcePath($path)
{
Deprecation::notice('5.0', 'Use getResource($path)->getPath() instead');
Deprecation::notice('4.0.1', 'Use getResource($path)->getPath() instead');
return $this
->getResource($path)
->getPath();
}
/**
* @deprecated 4.0.0:5.0.0 Use getResource($path)->getURL() instead
* @deprecated 4.0.1 Use getResource($path)->getURL() instead
* @param string $path
* @return string
*/
public function getResourceURL($path)
{
Deprecation::notice('5.0', 'Use getResource($path)->getURL() instead');
Deprecation::notice('4.0.1', 'Use getResource($path)->getURL() instead');
return $this
->getResource($path)
->getURL();
}
/**
* @deprecated 4.0.0:5.0.0 Use getResource($path)->exists() instead
* @deprecated 4.0.1 Use getResource($path)->exists() instead
* @param string $path
* @return string
*/
public function hasResource($path)
{
Deprecation::notice('5.0', 'Use getResource($path)->exists() instead');
Deprecation::notice('4.0.1', 'Use getResource($path)->exists() instead');
return $this
->getResource($path)
->exists();
@ -331,11 +333,11 @@ class Module implements Serializable
* that is observed is `PHP`
* @return array List of configuration aspects e.g.: `['PHP' => 'CI_PHPUNIT_NINE']`
* @internal
* @deprecated 5.0.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
public function getCIConfig(): array
{
Deprecation::notice('5.0.0', 'This method will be removed in CMS 5');
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality');
return [
'PHP' => $this->getPhpCiConfig()
];

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Core\Startup;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPRequest;
@ -15,7 +16,7 @@ use SilverStripe\Security\RandomGenerator;
*
* @internal This class is designed specifically for use pre-startup and may change without warning
*
* @deprecated 5.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
abstract class AbstractConfirmationToken
{
@ -39,6 +40,11 @@ abstract class AbstractConfirmationToken
* @param HTTPRequest $request
* @return static The token container for the unvalidated $key given with the highest priority
*/
public function __construct()
{
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
}
public static function prepare_tokens($keys, HTTPRequest $request)
{
$target = null;

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Core\Startup;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPResponse;
@ -13,7 +14,7 @@ use SilverStripe\Core\Convert;
*
* @internal This class is designed specifically for use pre-startup and may change without warning
*
* @deprecated 5.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
class ConfirmationTokenChain
{
@ -25,6 +26,11 @@ class ConfirmationTokenChain
/**
* @param AbstractConfirmationToken $token
*/
public function __construct()
{
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
}
public function pushToken(AbstractConfirmationToken $token)
{
$this->tokens[] = $token;

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Core\Startup;
use SilverStripe\Dev\Deprecation;
use Exception;
/**
@ -17,7 +18,7 @@ use Exception;
*
* @internal This class is designed specifically for use pre-startup and may change without warning
*
* @deprecated 5.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
class ErrorControlChain
{
@ -62,6 +63,11 @@ class ErrorControlChain
*
* @return bool
*/
public function __construct()
{
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
}
public function hasErrored()
{
return $this->error;

View File

@ -16,7 +16,7 @@ use SilverStripe\Security\Security;
*
* @internal This class is designed specifically for use pre-startup and may change without warning
*
* @deprecated 5.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
class ErrorControlChainMiddleware implements HTTPMiddleware
{
@ -40,9 +40,9 @@ class ErrorControlChainMiddleware implements HTTPMiddleware
*/
public function __construct(Application $application, $legacy = false)
{
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
$this->application = $application;
$this->legacy = $legacy;
Deprecation::notice('5.0', 'ErrorControlChainMiddleware is deprecated and will be removed completely');
}
/**

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Core\Startup;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
@ -15,7 +16,7 @@ use SilverStripe\Security\Security;
*
* @internal This class is experimental API and may change without warning
*
* @deprecated 5.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
class ErrorDirector extends Director
{
@ -27,6 +28,11 @@ class ErrorDirector extends Director
* @param Kernel $kernel
* @return null|HTTPResponse Redirection response, or null if not able to redirect
*/
public function __construct()
{
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
}
public function handleRequestWithTokenChain(
HTTPRequest $request,
ConfirmationTokenChain $confirmationTokenChain,

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Core\Startup;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPRequest;
@ -16,7 +17,7 @@ use SilverStripe\Security\RandomGenerator;
*
* @internal This class is designed specifically for use pre-startup and may change without warning
*
* @deprecated 5.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
class ParameterConfirmationToken extends AbstractConfirmationToken
{
@ -47,6 +48,7 @@ class ParameterConfirmationToken extends AbstractConfirmationToken
*/
public function __construct($parameterName, HTTPRequest $request)
{
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
// Store the parameter name
$this->parameterName = $parameterName;
$this->request = $request;

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Core\Startup;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPRequest;
@ -12,7 +13,7 @@ use SilverStripe\Control\HTTPRequest;
*
* @internal This class is designed specifically for use pre-startup and may change without warning
*
* @deprecated 5.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
class URLConfirmationToken extends AbstractConfirmationToken
{
@ -42,6 +43,7 @@ class URLConfirmationToken extends AbstractConfirmationToken
*/
public function __construct($urlToCheck, HTTPRequest $request)
{
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
$this->urlToCheck = $urlToCheck;
$this->request = $request;
$this->currentURL = $request->getURL(false);

View File

@ -173,10 +173,11 @@ class CsvBulkLoader extends BulkLoader
* @param int $lines Number of lines per file
*
* @return array List of file paths
* @deprecated 4.12.0 Process files using a stream instead
*/
protected function splitFile($path, $lines = null)
{
Deprecation::notice('5.0', 'Process files using a stream instead');
Deprecation::notice('4.12.0', 'Process files using a stream instead');
if (!is_int($lines)) {
$lines = $this->config()->get("lines");
@ -229,10 +230,11 @@ class CsvBulkLoader extends BulkLoader
/**
* @return string
* @deprecated 4.12.0 Name files yourself instead
*/
protected function getNewSplitFileName()
{
Deprecation::notice('5.0', 'Name files yourself instead');
Deprecation::notice('4.12.0', 'Name files yourself instead');
return TEMP_PATH . DIRECTORY_SEPARATOR . uniqid(str_replace('\\', '_', static::class) ?? '', true) . '.csv';
}
@ -241,10 +243,11 @@ class CsvBulkLoader extends BulkLoader
* @param boolean $preview
*
* @return BulkLoader_Result
* @deprecated 4.12.0 Process rows individually instead
*/
protected function processChunk($filepath, $preview = false)
{
Deprecation::notice('5.0', 'Process rows individually instead');
Deprecation::notice('4.12.0', 'Process rows individually instead');
$results = BulkLoader_Result::create();
$csv = new CSVParser(

View File

@ -143,65 +143,65 @@ class DebugView
}
/**
* @deprecated 4.0.0:5.0.0 Use renderHeader() instead
* @deprecated 4.0.1 Use renderHeader() instead
*/
public function writeHeader()
{
Deprecation::notice('4.0', 'Use renderHeader() instead');
Deprecation::notice('4.0.1', 'Use renderHeader() instead');
echo $this->renderHeader();
}
/**
* @deprecated 4.0.0:5.0.0 Use renderInfo() instead
* @deprecated 4.0.1 Use renderInfo() instead
*/
public function writeInfo($title, $subtitle, $description = false)
{
Deprecation::notice('4.0', 'Use renderInfo() instead');
Deprecation::notice('4.0.1', 'Use renderInfo() instead');
echo $this->renderInfo($title, $subtitle, $description);
}
/**
* @deprecated 4.0.0:5.0.0 Use renderFooter() instead
* @deprecated 4.0.1 Use renderFooter() instead
*/
public function writeFooter()
{
Deprecation::notice('4.0', 'Use renderFooter() instead');
Deprecation::notice('4.0.1', 'Use renderFooter() instead');
echo $this->renderFooter();
}
/**
* @deprecated 4.0.0:5.0.0 Use renderError() instead
* @deprecated 4.0.1 Use renderError() instead
*/
public function writeError($httpRequest, $errno, $errstr, $errfile, $errline)
{
Deprecation::notice('4.0', 'Use renderError() instead');
Deprecation::notice('4.0.1', 'Use renderError() instead');
echo $this->renderError($httpRequest, $errno, $errstr, $errfile, $errline);
}
/**
* @deprecated 4.0.0:5.0.0 Use renderSourceFragment() instead
* @deprecated 4.0.1 Use renderSourceFragment() instead
*/
public function writeSourceFragment($lines, $errline)
{
Deprecation::notice('4.0', 'Use renderSourceFragment() instead');
Deprecation::notice('4.0.1', 'Use renderSourceFragment() instead');
echo $this->renderSourceFragment($lines, $errline);
}
/**
* @deprecated 4.0.0:5.0.0 Use renderTrace() instead
* @deprecated 4.0.1 Use renderTrace() instead
*/
public function writeTrace($trace)
{
Deprecation::notice('4.0', 'Use renderTrace() instead');
Deprecation::notice('4.0.1', 'Use renderTrace() instead');
echo $this->renderTrace($trace);
}
/**
* @deprecated 4.0.0:5.0.0 Use renderVariable() instead
* @deprecated 4.0.1 Use renderVariable() instead
*/
public function writeVariable($val, $caller)
{
Deprecation::notice('4.0', 'Use renderVariable() instead');
Deprecation::notice('4.0.1', 'Use renderVariable() instead');
echo $this->renderVariable($val, $caller);
}

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Dev;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Control\Controller;
/**
@ -15,6 +16,11 @@ class InstallerTest extends Controller
'testrewrite'
];
public function __construct()
{
Deprecation::notice('4.4.7', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
}
public function testrewrite()
{
echo "OK";

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Dev;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Security\Permission;
@ -19,6 +20,11 @@ class SapphireInfo extends Controller
'environmenttype',
];
public function __construct()
{
Deprecation::notice('4.4.7', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
}
protected function init()
{
parent::init();

View File

@ -50,18 +50,22 @@ class TestKernel extends CoreKernel
/**
* Set a list of CI configurations that should cause a module's test not to be added to a manifest
* @param string[] $ciConfigs
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
public function setIgnoredCIConfigs(array $ciConfigs): self
{
Deprecation::notice('5.0.0', 'Will be removed without equivalent functionality');
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality');
$this->ciConfigs = $ciConfigs;
return $this;
}
/**
* @deprecated 4.12.0 Will be removed without equivalent functionality
*/
protected function getIgnoredCIConfigs(): array
{
Deprecation::notice('5.0.0', 'Will be removed without equivalent functionality');
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality');
return $this->ciConfigs;
}

View File

@ -180,13 +180,13 @@ class FieldList extends ArrayList
}
/**
* @deprecated 4.1.0:5.0.0 Please use dataFields or saveableFields instead
* @deprecated 4.1.0 Please use dataFields or saveableFields instead
* @param $list
* @param bool $saveableOnly
*/
protected function collateDataFields(&$list, $saveableOnly = false)
{
Deprecation::notice('5.0', 'Please use dataFields() or SaveableFields()');
Deprecation::notice('4.1.0', 'Please use dataFields or saveableFields instead');
if (!isset($list)) {
$list = [];
}

View File

@ -1587,12 +1587,12 @@ class Form extends ViewableData implements HasRequestHandler
* and _form_enctype. These are the attributes of the form. These fields
* can be used to send the form to Ajax.
*
* @deprecated 5.0 Will be removed without equivalent functionality
* @deprecated 4.12.0 Will be removed without equivalent functionality
* @return string
*/
public function formHtmlContent()
{
Deprecation::notice('5.0');
Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality');
$this->IncludeFormTag = false;
$content = $this->forTemplate();
$this->IncludeFormTag = true;

View File

@ -435,13 +435,13 @@ class GridFieldFilterHeader extends AbstractGridFieldComponent implements GridFi
/**
* Generate fields for the legacy filter header row
*
* @deprecated 5.0
* @deprecated 4.12.0 Use search field instead
* @param GridField $gridfield
* @return ArrayList|null
*/
public function getLegacyFilterHeader(GridField $gridField)
{
Deprecation::notice('5.0', 'Use search field instead');
Deprecation::notice('4.12.0', 'Use search field instead');
$list = $gridField->getList();
if (!$this->checkDataType($list)) {

View File

@ -11,13 +11,13 @@ if (!class_exists(VersionedGridFieldState::class)) {
/**
* @deprecated 4.1.0:5.0.0 Use VersionedGridFieldState instead
* @deprecated 4.1.0 Use VersionedGridFieldState instead
*/
class GridFieldVersionedState extends VersionedGridFieldState
{
public function __construct(array $versionedLabelFields = ['Name', 'Title'])
{
Deprecation::notice('4.1.0', 'Use VersionedGridFieldState instead', Deprecation::SCOPE_CLASS);
parent::__construct($versionedLabelFields);
Deprecation::notice('5.0', 'Use ' . VersionedGridFieldState::class . ' instead');
}
}

View File

@ -875,21 +875,21 @@ class TinyMCEConfig extends HTMLEditorConfig implements i18nEntityProvider
}
/**
* @deprecated 4.0.0:5.0.0 Use getTinyMCEResourcePath() instead
* @deprecated 4.0.1 Use getTinyMCEResourcePath() instead
*/
public function getTinyMCEPath()
{
Deprecation::notice('5.0', 'use getTinyMCEResourcePath instead');
Deprecation::notice('4.0.1', 'Use getTinyMCEResourcePath() instead');
return $this->getTinyMCEResourcePath();
}
/**
* @return Module
* @deprecated 4.0.0:5.0.0
* @deprecated 4.0.1 Set base_dir or editor_css config instead
*/
protected function getAdminModule()
{
Deprecation::notice('5.0', 'Set base_dir or editor_css config instead');
Deprecation::notice('4.0.1', 'Set base_dir or editor_css config instead');
return ModuleLoader::getModule('silverstripe/admin');
}

View File

@ -11,7 +11,7 @@ use TinyMCE_Compressor;
/**
* Uses the default tiny_mc_gzip.php handler
*
* @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality
* @deprecated 4.0.1 Will be removed without equivalent functionality
*/
class TinyMCEGZIPGenerator implements TinyMCEScriptGenerator
{
@ -19,7 +19,7 @@ class TinyMCEGZIPGenerator implements TinyMCEScriptGenerator
public function __construct()
{
Deprecation::notice('5.0', 'Legacy tiny_mce_gzip compressor is deprecated');
Deprecation::notice('4.0.1', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS);
}
/**

View File

@ -121,10 +121,11 @@ class TextField extends FormField implements TippableFieldInterface
/**
* @return string
* @deprecated 4.0.1 Use setValue() instead
*/
public function InternallyLabelledField()
{
Deprecation::notice('4.0', 'Use setValue() instead');
Deprecation::notice('4.0.1', 'Use setValue() instead');
if (!$this->value) {
$this->value = $this->Title();

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Forms;
use SilverStripe\Dev\Deprecation;
use Exception;
use InvalidArgumentException;
use SilverStripe\Assets\Folder;
@ -621,12 +622,13 @@ class TreeDropdownField extends FormField
/**
* HTML-encoded label for this node, including css classes and other markup.
*
* @deprecated 4.0.0:5.0.0 Use setTitleField() instead
* @deprecated 4.0.1 Use setTitleField() instead
* @param string $field
* @return $this
*/
public function setLabelField($field)
{
Deprecation::notice('4.0.1', 'Use setTitleField() instead');
$this->labelField = $field;
return $this;
}
@ -634,11 +636,12 @@ class TreeDropdownField extends FormField
/**
* HTML-encoded label for this node, including css classes and other markup.
*
* @deprecated 4.0.0:5.0.0 Use getTitleField() instead
* @deprecated 4.0.1 Use getTitleField() instead
* @return string
*/
public function getLabelField()
{
Deprecation::notice('4.0.1', 'Use getTitleField() instead');
return $this->labelField;
}

View File

@ -18,13 +18,13 @@ class MonologErrorHandler implements ErrorHandler
* Set the PSR-3 logger to send errors & exceptions to. Will overwrite any previously configured
* loggers
*
* @deprecated 4.4.0:5.0.0 Use pushLogger() instead
* @deprecated 4.4.0 Use pushLogger() instead
* @param LoggerInterface $logger
* @return $this
*/
public function setLogger(LoggerInterface $logger)
{
Deprecation::notice('4.4.0', 'Please use pushLogger() instead');
Deprecation::notice('4.4.0', 'Use pushLogger() instead');
$this->loggers = [$logger];
return $this;
@ -33,12 +33,12 @@ class MonologErrorHandler implements ErrorHandler
/**
* Get the first registered PSR-3 logger to send errors & exceptions to
*
* @deprecated 4.4.0:5.0.0 Use getLoggers() instead
* @deprecated 4.4.0 Use getLoggers() instead
* @return LoggerInterface
*/
public function getLogger()
{
Deprecation::notice('4.4.0', 'Please use getLoggers() instead');
Deprecation::notice('4.4.0', 'Use getLoggers() instead');
return reset($this->loggers);
}

View File

@ -2,6 +2,7 @@
namespace SilverStripe\ORM\Connect;
use SilverStripe\Dev\Deprecation;
use Exception;
use SilverStripe\Control\Director;
use SilverStripe\Core\Config\Config;
@ -60,10 +61,11 @@ abstract class DBSchemaManager
* @param string $table
* @param string $class
*
* @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality
* @deprecated 4.0.1 Will be removed without equivalent functionality
*/
public static function showTableNameWarning($table, $class)
{
Deprecation::notice('4.0.1', 'Will be removed without equivalent functionality');
static::$table_name_warnings[$table] = $class;
}

View File

@ -140,9 +140,12 @@ class PDOConnector extends DBConnector implements TransactionManager
return self::config()->get('emulate_prepare');
}
/**
* @deprecated 4.5.0 Use native database drivers instead
*/
public function connect($parameters, $selectDB = false)
{
Deprecation::notice('4.5', 'Use native database drivers instead');
Deprecation::notice('4.5.0', 'Use native database drivers instead');
$this->flushStatements();

View File

@ -112,12 +112,12 @@ class DB
}
/**
* @deprecated Use DB::get_conn() instead
* @deprecated 4.0.1 Use DB::get_conn() instead
* @todo PSR-2 standardisation will probably un-deprecate this
*/
public static function getConn($name = 'default')
{
Deprecation::notice('4.0', 'Use DB::get_conn() instead');
Deprecation::notice('4.0.1', 'Use DB::get_conn() instead');
return self::get_conn($name);
}

View File

@ -2,6 +2,7 @@
namespace SilverStripe\ORM;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\FieldList;
@ -23,6 +24,7 @@ abstract class DataExtension extends Extension
*/
public static function unload_extra_statics($class, $extension)
{
Deprecation::notice('4.7.0', 'Will be removed without equivalent functionality');
throw new Exception('unload_extra_statics gone');
}

View File

@ -600,14 +600,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
/**
* Copies the many_many and belongs_many_many relations from one object to another instance of the name of object.
*
* @deprecated 4.1.0:5.0.0 Use duplicateRelations() instead
* @deprecated 4.1.0 Use duplicateRelations() instead
* @param DataObject $sourceObject the source object to duplicate from
* @param DataObject $destinationObject the destination object to populate with the duplicated relations
* @param bool|string $filter
*/
protected function duplicateManyManyRelations($sourceObject, $destinationObject, $filter)
{
Deprecation::notice('5.0', 'Use duplicateRelations() instead');
Deprecation::notice('4.1.0', 'Use duplicateRelations() instead');
// Get list of relations to duplicate
if ($filter === 'many_many' || $filter === 'belongs_many_many') {
@ -1266,10 +1266,11 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
* Public accessor for {@see DataObject::validate()}
*
* @return ValidationResult
* @deprecated 4.12.0 Use validate() instead
*/
public function doValidate()
{
Deprecation::notice('5.0', 'Use validate() instead');
Deprecation::notice('4.12.0', 'Use validate() instead');
return $this->validate();
}

View File

@ -376,11 +376,11 @@ class DatabaseAdmin extends Controller
* @param string $fieldName The field name to look in for obsolete class names
* @param string $oldClassName The old class name
* @param string $newClassName The new class name
* @deprecated 5.0 use updateLegacyClassNameField() instead
* @deprecated 4.12.0 Use updateLegacyClassNameField() instead
*/
protected function updateLegacyClassNames($dataClass, $fieldName, $oldClassName, $newClassName)
{
Deprecation::notice('5.0', 'use updateLegacyClassNameField instead');
Deprecation::notice('4.12.0', 'Use updateLegacyClassNameField() instead');
$this->updateLegacyClassNameField($dataClass, $fieldName, [$oldClassName => $newClassName]);
}

View File

@ -35,10 +35,11 @@ class DBClassName extends DBEnum
/**
* Clear all cached classname specs. It's necessary to clear all cached subclassed names
* for any classes if a new class manifest is generated.
* @deprecated 4.3.0 Use DBEnum::flushCache() instead
*/
public static function clear_classname_cache()
{
Deprecation::notice('4.3', 'Use DBEnum::flushCache() instead');
Deprecation::notice('4.3.0', 'Use DBEnum::flushCache() instead');
DBEnum::flushCache();
}

View File

@ -232,10 +232,11 @@ class ValidationResult implements Serializable
* The __serialize() magic method will be automatically used instead of this
*
* @return string
* @deprecated Use __serialize() instead
* @deprecated 4.12.0 Use __serialize() instead
*/
public function serialize()
{
Deprecation::notice('4.12.0', 'Use __serialize() instead');
return json_encode([$this->messages, $this->isValid]);
}
@ -245,10 +246,11 @@ class ValidationResult implements Serializable
* and the PHP version used in less than PHP 9.0
*
* @param string $serialized
* @deprecated Use __unserialize() instead
* @deprecated 4.12.0 Use __unserialize() instead
*/
public function unserialize($serialized)
{
Deprecation::notice('4.12.0', 'Use __unserialize() instead');
list($this->messages, $this->isValid) = json_decode($serialized ?? '', true);
}
}

View File

@ -282,26 +282,26 @@ class Member extends DataObject
/**
* Get the default admin record if it exists, or creates it otherwise if enabled
*
* @deprecated 4.0.0:5.0.0 Use DefaultAdminService::findOrCreateDefaultAdmin() instead
* @deprecated 4.0.1 Use DefaultAdminService::findOrCreateDefaultAdmin() instead
* @return Member
*/
public static function default_admin()
{
Deprecation::notice('5.0', 'Use DefaultAdminService::findOrCreateDefaultAdmin() instead');
Deprecation::notice('4.0.1', 'Use DefaultAdminService::findOrCreateDefaultAdmin() instead');
return DefaultAdminService::singleton()->findOrCreateDefaultAdmin();
}
/**
* Check if the passed password matches the stored one (if the member is not locked out).
*
* @deprecated 4.0.0:5.0.0 Use Authenticator::checkPassword() instead
* @deprecated 4.0.1 Use Authenticator::checkPassword() instead
*
* @param string $password
* @return ValidationResult
*/
public function checkPassword($password)
{
Deprecation::notice('5.0', 'Use Authenticator::checkPassword() instead');
Deprecation::notice('4.0.1', 'Use Authenticator::checkPassword() instead');
// With a valid user and password, check the password is correct
$result = ValidationResult::create();
@ -448,15 +448,12 @@ class Member extends DataObject
}
/**
* @deprecated 5.0.0 Use Security::setCurrentUser() or IdentityStore::logIn() instead
* @deprecated 4.12.0 Use Security::setCurrentUser() or IdentityStore::logIn() instead
*
*/
public function logIn()
{
Deprecation::notice(
'5.0.0',
'This method is deprecated and only logs in for the current request. Please use Security::setCurrentUser($user) or an IdentityStore'
);
Deprecation::notice('4.12.0', 'Use Security::setCurrentUser() or IdentityStore::logIn() instead');
Security::setCurrentUser($this);
}
@ -509,16 +506,13 @@ class Member extends DataObject
* has a database record of the same ID. If there is
* no logged in user, FALSE is returned anyway.
*
* @deprecated Use Security::getCurrentUser() instead
* @deprecated 4.12.0 Use Security::getCurrentUser() instead
*
* @return boolean TRUE record found FALSE no record found
*/
public static function logged_in_session_exists()
{
Deprecation::notice(
'5.0.0',
'This method is deprecated and now does not add value. Please use Security::getCurrentUser()'
);
Deprecation::notice('4.12.0', 'Use Security::getCurrentUser() instead');
$member = Security::getCurrentUser();
if ($member && $member->exists()) {
@ -531,14 +525,11 @@ class Member extends DataObject
/**
* Logs this member out.
*
* @deprecated Use Security::setCurrentUser(null) or an IdentityStore instead
* @deprecated 4.12.0 Use Security::setCurrentUser(null) or an IdentityStore instead
*/
public function logOut()
{
Deprecation::notice(
'5.0.0',
'This method is deprecated and now does not persist. Please use Security::setCurrentUser(null) or an IdentityStore'
);
Deprecation::notice('4.12.0', 'Use Security::setCurrentUser(null) or an IdentityStore instead');
Injector::inst()->get(IdentityStore::class)->logOut(Controller::curr()->getRequest());
}
@ -770,16 +761,13 @@ class Member extends DataObject
/**
* Returns the current logged in user
*
* @deprecated 5.0.0 Use Security::getCurrentUser() instead
* @deprecated 4.12.0 Use Security::getCurrentUser() instead
*
* @return Member
*/
public static function currentUser()
{
Deprecation::notice(
'5.0.0',
'This method is deprecated. Please use Security::getCurrentUser() or an IdentityStore'
);
Deprecation::notice('4.12.0', 'Use Security::getCurrentUser() instead');
return Security::getCurrentUser();
}
@ -820,16 +808,13 @@ class Member extends DataObject
/**
* Get the ID of the current logged in user
*
* @deprecated 5.0.0 Use Security::getCurrentUser() instead
* @deprecated 4.12.0 Use Security::getCurrentUser() instead
*
* @return int Returns the ID of the current logged in user or 0.
*/
public static function currentUserID()
{
Deprecation::notice(
'5.0.0',
'This method is deprecated. Please use Security::getCurrentUser() or an IdentityStore'
);
Deprecation::notice('4.12.0', 'Use Security::getCurrentUser() instead');
$member = Security::getCurrentUser();
if ($member) {
@ -1118,10 +1103,11 @@ class Member extends DataObject
/**
* @param array $columns Column names on the Member record to show in {@link getTitle()}.
* @param string $sep Separator
* @deprecated 4.12.0 Use Member.title_format config instead
*/
public static function set_title_columns($columns, $sep = ' ')
{
Deprecation::notice('5.0', 'Use Member.title_format config instead');
Deprecation::notice('4.12.0', 'Use Member.title_format config instead');
if (!is_array($columns)) {
$columns = [$columns];
}

View File

@ -84,7 +84,7 @@ class PasswordValidator
*/
public function minLength($minLength)
{
Deprecation::notice('4.5.0', 'Use ->setMinLength($value) instead.');
Deprecation::notice('4.5.0', 'Use setMinLength() instead');
return $this->setMinLength($minLength);
}
@ -100,10 +100,7 @@ class PasswordValidator
*/
public function characterStrength($minScore, $testNames = null)
{
Deprecation::notice(
'4.5.0',
'Use ->setMinTestScore($score) and ->setTestNames($names) instead.'
);
Deprecation::notice('4.5.0', 'Use setMinTestScore($score) and setTestNames($names) instead');
$this->setMinTestScore($minScore);
if ($testNames) {
$this->setTestNames($testNames);
@ -120,7 +117,7 @@ class PasswordValidator
*/
public function checkHistoricalPasswords($count)
{
Deprecation::notice('4.5.0', 'Use ->setHistoricCount($value) instead.');
Deprecation::notice('4.5.0', 'Use setHistoricCount($value) instead');
return $this->setHistoricCount($count);
}

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Security;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Resettable;
use SilverStripe\Dev\TestOnly;
@ -664,6 +665,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl
*/
public static function get_declared_permissions_list()
{
Deprecation::notice('4.4.0', 'Will be removed without equivalent functionality');
if (!self::$declared_permissions) {
return null;
}
@ -688,6 +690,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl
*/
public static function get_label_for_permission($perm)
{
Deprecation::notice('4.4.0', 'Will be removed without equivalent functionality');
$list = self::get_declared_permissions_list();
if (array_key_exists($perm, $list ?? [])) {
return $list[$perm];
@ -706,6 +709,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl
*/
protected static function traverse_declared_permissions($declared, &$list)
{
Deprecation::notice('4.4.0', 'Will be removed without equivalent functionality');
if (!is_array($declared)) {
return;
}

View File

@ -14,11 +14,11 @@ class RandomGenerator
/**
* @return string A 128-character, randomly generated ASCII string
* @throws Exception If no suitable CSPRNG is installed
* @deprecated 4.4.0:5.0.0 Use native php function random_bytes() instead
* @deprecated 4.4.0 Use native php function random_bytes() instead
*/
public function generateEntropy()
{
Deprecation::notice('4.4', __METHOD__ . ' has been deprecated. Use random_bytes instead');
Deprecation::notice('4.4.0', 'Use native php function random_bytes() instead');
try {
return bin2hex(random_bytes(64));

View File

@ -464,7 +464,7 @@ class Security extends Controller implements TemplateGlobalProvider
/**
* Get the login forms for all available authentication methods
*
* @deprecated 5.0.0 Use delegateToMultipleHandlers() instead
* @deprecated 4.12.0 Use delegateToMultipleHandlers() instead
*
* @return array Returns an array of available login forms (array of Form
* objects).
@ -472,7 +472,7 @@ class Security extends Controller implements TemplateGlobalProvider
*/
public function getLoginForms()
{
Deprecation::notice('5.0.0', 'Now handled by delegateToMultipleHandlers');
Deprecation::notice('4.12.0', 'Use delegateToMultipleHandlers() instead');
return array_map(
function (Authenticator $authenticator) {
@ -1073,11 +1073,11 @@ class Security extends Controller implements TemplateGlobalProvider
*
* @return Member
*
* @deprecated 4.0.0:5.0.0 Use DefaultAdminService::findOrCreateDefaultAdmin()
* @deprecated 4.0.1 Use DefaultAdminService::findOrCreateDefaultAdmin()
*/
public static function findAnAdministrator()
{
Deprecation::notice('5.0.0', 'Please use DefaultAdminService::findOrCreateDefaultAdmin()');
Deprecation::notice('4.0.1', 'Use DefaultAdminService::findOrCreateDefaultAdmin()');
$service = DefaultAdminService::singleton();
return $service->findOrCreateDefaultAdmin();
@ -1086,11 +1086,11 @@ class Security extends Controller implements TemplateGlobalProvider
/**
* Flush the default admin credentials
*
* @deprecated 4.0.0:5.0.0 Use DefaultAdminService::clearDefaultAdmin()
* @deprecated 4.0.1 Use DefaultAdminService::clearDefaultAdmin()
*/
public static function clear_default_admin()
{
Deprecation::notice('5.0.0', 'Please use DefaultAdminService::clearDefaultAdmin()');
Deprecation::notice('4.0.1', 'Use DefaultAdminService::clearDefaultAdmin()');
DefaultAdminService::clearDefaultAdmin();
}
@ -1107,11 +1107,11 @@ class Security extends Controller implements TemplateGlobalProvider
* @param string $password The password (in cleartext)
* @return bool True if successfully set
*
* @deprecated 4.0.0:5.0.0 Use DefaultAdminService::setDefaultAdmin($username, $password)
* @deprecated 4.0.1 Use DefaultAdminService::setDefaultAdmin($username, $password)
*/
public static function setDefaultAdmin($username, $password)
{
Deprecation::notice('5.0.0', 'Please use DefaultAdminService::setDefaultAdmin($username, $password)');
Deprecation::notice('4.0.1', 'Use DefaultAdminService::setDefaultAdmin($username, $password)');
DefaultAdminService::setDefaultAdmin($username, $password);
return true;
@ -1125,11 +1125,11 @@ class Security extends Controller implements TemplateGlobalProvider
* @param string $password
* @return bool
*
* @deprecated 4.0.0:5.0.0 Use DefaultAdminService::isDefaultAdminCredentials() instead
* @deprecated 4.0.1 Use DefaultAdminService::isDefaultAdminCredentials() instead
*/
public static function check_default_admin($username, $password)
{
Deprecation::notice('5.0.0', 'Please use DefaultAdminService::isDefaultAdminCredentials($username, $password)');
Deprecation::notice('4.0.1', 'Use DefaultAdminService::isDefaultAdminCredentials() instead');
/** @var DefaultAdminService $service */
return DefaultAdminService::isDefaultAdminCredentials($username, $password);
@ -1138,11 +1138,11 @@ class Security extends Controller implements TemplateGlobalProvider
/**
* Check that the default admin account has been set.
*
* @deprecated 4.0.0:5.0.0 Use DefaultAdminService::hasDefaultAdmin() instead
* @deprecated 4.0.1 Use DefaultAdminService::hasDefaultAdmin() instead
*/
public static function has_default_admin()
{
Deprecation::notice('5.0.0', 'Please use DefaultAdminService::hasDefaultAdmin()');
Deprecation::notice('4.0.1', 'Use DefaultAdminService::hasDefaultAdmin() instead');
return DefaultAdminService::hasDefaultAdmin();
}
@ -1150,12 +1150,12 @@ class Security extends Controller implements TemplateGlobalProvider
/**
* Get default admin username
*
* @deprecated 4.0.0:5.0.0 Use DefaultAdminService::getDefaultAdminUsername() instead
* @deprecated 4.0.1 Use DefaultAdminService::getDefaultAdminUsername() instead
* @return string
*/
public static function default_admin_username()
{
Deprecation::notice('5.0.0', 'Please use DefaultAdminService::getDefaultAdminUsername()');
Deprecation::notice('4.0.1', 'Use DefaultAdminService::getDefaultAdminUsername() instead');
return DefaultAdminService::getDefaultAdminUsername();
}
@ -1163,12 +1163,12 @@ class Security extends Controller implements TemplateGlobalProvider
/**
* Get default admin password
*
* @deprecated 4.0.0:5.0.0 Use DefaultAdminService::getDefaultAdminPassword() instead
* @deprecated 4.0.1 Use DefaultAdminService::getDefaultAdminPassword() instead
* @return string
*/
public static function default_admin_password()
{
Deprecation::notice('5.0.0', 'Please use DefaultAdminService::getDefaultAdminPassword()');
Deprecation::notice('4.0.1', 'Use DefaultAdminService::getDefaultAdminPassword() instead');
return DefaultAdminService::getDefaultAdminPassword();
}

View File

@ -15,7 +15,7 @@ use SilverStripe\Dev\Deprecation;
* Encapsulation of an embed tag, linking to an external media source.
*
* @see Embed
* @deprecated 4.11..5.0 Use EmbedContainer instead
* @deprecated 4.11.0 Use EmbedContainer instead
*/
class EmbedResource implements Embeddable
{
@ -46,7 +46,7 @@ class EmbedResource implements Embeddable
*/
public function __construct($url)
{
Deprecation::notice('4.11', 'Use EmbedContainer instead');
Deprecation::notice('4.11.0', 'Use EmbedContainer instead', Deprecation::SCOPE_CLASS);
$this->url = $url;
}

View File

@ -239,10 +239,11 @@ class Requirements_Backend
* Gets the minification service for this backend
*
* @return Requirements_Minifier
* @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality
* @deprecated 4.0.1 Will be removed without equivalent functionality
*/
public function getMinifier()
{
Deprecation::notice('4.0.1', 'Will be removed without equivalent functionality');
return $this->minifier;
}

View File

@ -297,11 +297,11 @@ class SSViewer implements Flushable
/**
* @param string $theme The "base theme" name (without underscores).
* @deprecated 4.0.0:5.0.0 Use SSViewer::set_themes() instead
* @deprecated 4.0.1 Use SSViewer::set_themes() instead
*/
public static function set_theme($theme)
{
Deprecation::notice('4.0', 'Use the "SSViewer#set_themes" instead');
Deprecation::notice('4.0.1', 'Use SSViewer::set_themes() instead');
self::set_themes([$theme, self::DEFAULT_THEME]);
}

View File

@ -67,12 +67,12 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
}
/**
* @deprecated 5.0.0 Use IsFirst() instead
* @deprecated 4.12.0 Use IsFirst() instead
* @return bool
*/
public function First()
{
Deprecation::notice('5.0.0', 'Use IsFirst() to avoid clashes with SS_Lists');
Deprecation::notice('4.12.0', 'Use IsFirst() instead');
return $this->IsFirst();
}
@ -87,12 +87,12 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
}
/**
* @deprecated 5.0.0 Use IsLast() instead
* @deprecated 4.12.0 Use IsLast() instead
* @return bool
*/
public function Last()
{
Deprecation::notice('5.0.0', 'Use IsLast() to avoid clashes with SS_Lists');
Deprecation::notice('4.12.0', 'Use IsLast() instead');
return $this->IsLast();
}

View File

@ -160,11 +160,11 @@ class EmbedShortcodeProvider implements ShortcodeHandler
* @param Adapter $embed
* @param array $arguments Additional shortcode params
* @return string
* @deprecated 4.11..5.0 Use embeddableToHtml() instead
* @deprecated 4.11.0 Use embeddableToHtml() instead
*/
public static function embedForTemplate($embed, $arguments)
{
Deprecation::notice('4.11', 'Use embeddableToHtml() instead');
Deprecation::notice('4.11.0', 'Use embeddableToHtml() instead');
switch ($embed->getType()) {
case 'video':
case 'rich':

View File

@ -619,11 +619,11 @@ class ViewableData implements IteratorAggregate
* project directory.
*
* @return string URL to the current theme
* @deprecated 4.0.0:5.0.0 Use ModuleResourceLoader::resourcePath() or ModuleResourceLoader::resourceURL() instead
* @deprecated 4.0.1 Use ModuleResourceLoader::resourcePath() or ModuleResourceLoader::resourceURL() instead
*/
public function ThemeDir()
{
Deprecation::notice('5.0', 'Use $resourcePath or $resourceURL template helpers instead');
Deprecation::notice('4.0.1', 'Use ModuleResourceLoader::resourcePath() or ModuleResourceLoader::resourceURL() instead');
$themes = SSViewer::get_themes();
foreach ($themes as $theme) {
// Skip theme sets

View File

@ -2,6 +2,7 @@
namespace SilverStripe\i18n\Messages\Symfony;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Core\Flushable;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
@ -54,10 +55,11 @@ class FlushInvalidatedResource implements SelfCheckingResourceInterface, \Serial
* The __serialize() magic method will be automatically used instead of this
*
* @return string
* @deprecated Use __serialize() instead
* @deprecated 4.12.0 Use __serialize() instead
*/
public function serialize()
{
Deprecation::notice('4.12.0', 'Use __serialize() instead');
return '';
}
@ -67,10 +69,11 @@ class FlushInvalidatedResource implements SelfCheckingResourceInterface, \Serial
* and the PHP version used in less than PHP 9.0
*
* @param string $serialized
* @deprecated Use __unserialize() instead
* @deprecated 4.12.0 Use __unserialize() instead
*/
public function unserialize($serialized)
{
Deprecation::notice('4.12.0', 'Use __unserialize() instead');
// no-op
}