Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Remove deprecated code #10594

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions .upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ mappings:
SS_ClassManifest: SilverStripe\Core\Manifest\ClassManifest
SilverStripe\Core\Manifest\SS_ClassManifest: SilverStripe\Core\Manifest\ClassManifest
ManifestFileFinder: SilverStripe\Core\Manifest\ManifestFileFinder
ErrorControlChain: SilverStripe\Core\Startup\ErrorControlChain
ParameterConfirmationToken: SilverStripe\Core\Startup\ParameterConfirmationToken
DatabaseAdapterRegistry: SilverStripe\Dev\Install\DatabaseAdapterRegistry
DatabaseConfigurationHelper: SilverStripe\Dev\Install\DatabaseConfigurationHelper
MySQLDatabaseConfigurationHelper: SilverStripe\Dev\Install\MySQLDatabaseConfigurationHelper
Expand All @@ -192,7 +190,6 @@ mappings:
CliDebugView: SilverStripe\Dev\CliDebugView
CSSContentParser: SilverStripe\Dev\CSSContentParser
CsvBulkLoader: SilverStripe\Dev\CsvBulkLoader
CSVParser: SilverStripe\Dev\CSVParser
Debug: SilverStripe\Dev\Debug
DebugView: SilverStripe\Dev\DebugView
Deprecation: SilverStripe\Dev\Deprecation
Expand All @@ -201,7 +198,6 @@ mappings:
FixtureBlueprint: SilverStripe\Dev\FixtureBlueprint
FixtureFactory: SilverStripe\Dev\FixtureFactory
FunctionalTest: SilverStripe\Dev\FunctionalTest
InstallerTest: SilverStripe\Dev\InstallerTest
MigrationTask: SilverStripe\Dev\MigrationTask
SapphireTest: SilverStripe\Dev\SapphireTest
TaskRunner: SilverStripe\Dev\TaskRunner
Expand Down Expand Up @@ -229,17 +225,13 @@ mappings:
NestedController: SilverStripe\Control\NestedController
NullHTTPRequest: SilverStripe\Control\NullHTTPRequest
PjaxResponseNegotiator: SilverStripe\Control\PjaxResponseNegotiator
RequestFilter: SilverStripe\Control\RequestFilter
RequestHandler: SilverStripe\Control\RequestHandler
RequestProcessor: SilverStripe\Control\RequestProcessor
Session: SilverStripe\Control\Session
Email: SilverStripe\Control\Email\Email
Mailer: SilverStripe\Control\Email\Mailer
RSSFeed: SilverStripe\Control\RSS\RSSFeed
RSSFeed_Entry: SilverStripe\Control\RSS\RSSFeed_Entry
CleanupTestDatabasesTask: SilverStripe\Dev\Tasks\CleanupTestDatabasesTask
i18nTextCollectorTask: SilverStripe\Dev\Tasks\i18nTextCollectorTask
MigrateFileTask: SilverStripe\Dev\Tasks\MigrateFileTask
CheckboxField: SilverStripe\Forms\CheckboxField
CheckboxField_Readonly: SilverStripe\Forms\CheckboxField_Readonly
CheckboxSetField: SilverStripe\Forms\CheckboxSetField
Expand Down Expand Up @@ -372,7 +364,6 @@ mappings:
GenericTemplateGlobalProvider: SilverStripe\View\GenericTemplateGlobalProvider
Requirements: SilverStripe\View\Requirements
Requirements_Backend: SilverStripe\View\Requirements_Backend
Requirements_Minifier: SilverStripe\View\Requirements_Minifier
SSTemplateParseException: SilverStripe\View\SSTemplateParseException
SSTemplateParser: SilverStripe\View\SSTemplateParser
SSViewer_Scope: SilverStripe\View\SSViewer_Scope
Expand Down Expand Up @@ -487,7 +478,6 @@ mappings:
CsvBulkLoaderTest_Team: SilverStripe\Dev\Tests\CsvBulkLoaderTest\Team
CsvBulkLoaderTest_Player: SilverStripe\Dev\Tests\CsvBulkLoaderTest\Player
CsvBulkLoaderTest_PlayerContract: SilverStripe\Dev\Tests\CsvBulkLoaderTest\PlayerContract
CSVParserTest: SilverStripe\Dev\Tests\CSVParserTest
DeprecationTest_Deprecation: SilverStripe\Dev\Tests\DeprecationTest\TestDeprecation
DeprecationTest: SilverStripe\Dev\Tests\DeprecationTest
DevAdminControllerTest: SilverStripe\Dev\Tests\DevAdminControllerTest
Expand Down Expand Up @@ -847,11 +837,6 @@ mappings:
ThemeResourceLoaderTest: SilverStripe\Core\Tests\Manifest\ThemeResourceLoaderTest
EmailTest: SilverStripe\Control\Tests\Email\EmailTest
MailerTest: SilverStripe\Control\Tests\Email\SwiftMailerTest
ErrorControlChainTest_Chain: SilverStripe\Core\Tests\Startup\ErrorControlChainTest\ErrorControlChainTest_Chain
ErrorControlChainTest: SilverStripe\Core\Tests\Startup\ErrorControlChainTest
ParameterConfirmationTokenTest_Token: SilverStripe\Core\Tests\Startup\ParameterConfirmationTokenTest\ParameterConfirmationTokenTest_Token
ParameterConfirmationTokenTest_ValidToken: SilverStripe\Core\Tests\Startup\ParameterConfirmationTokenTest\ParameterConfirmationTokenTest_ValidToken
ParameterConfirmationTokenTest: SilverStripe\Core\Tests\Startup\ParameterConfirmationTokenTest
ConfigTest_DefinesFoo: SilverStripe\Core\Tests\Config\ConfigTest\DefinesFoo
ConfigTest_DefinesBar: SilverStripe\Core\Tests\Config\ConfigTest\DefinesBar
ConfigTest_DefinesFooAndBar: SilverStripe\Core\Tests\Config\ConfigTest\DefinesFooAndBar
Expand Down Expand Up @@ -981,8 +966,6 @@ warnings:
message: 'Renamed to CMSMain_TreeNode'
'HTMLEditorField_Toolbar':
message: 'replaced With SilverStripe\Admin\ModalController'
'HTMLEditorField_Embed':
message: 'replaced with SilverStripe\View\Embed\EmbedResource'
'HTMLEditorField_File':
message: 'Removed'
'HTMLEditorField_Flash':
Expand All @@ -1009,14 +992,8 @@ warnings:
message: 'Use SilverStripe\CMS\BatchActions\CMSBatchAction_Archive instead'
'EncryptAllPasswordsTask':
message: 'Removed'
'SapphireInfo':
message: 'Removed'
'SilverStripe\Dev\SapphireREPL':
message: 'Removed'
'SilverStripe\Dev\SapphireInfo':
message: 'Deprecated'
'SilverStripe\Dev\InstallerTest':
message: 'Deprecated'
methods:
'SilverStripe\Security\Authenticator::register()':
message: 'Custom authenticators work differently now'
Expand Down Expand Up @@ -1309,12 +1286,6 @@ warnings:
message: 'Removed SilverStripe\ORM\FieldType\DBDate->day_before()'
'days_between()':
message: 'Removed SilverStripe\ORM\FieldType\DBDate->days_between()'
'SilverStripe\Security\Permission::get_declared_permissions_list()':
message: 'Deprecated'
'SilverStripe\Security\Permission::get_label_for_permission()':
message: 'Deprecated'
'SilverStripe\Security\Permission::traverse_declared_permissions()':
message: 'Deprecated'
'SilverStripe\Control\Session::get_all()':
message: 'Session can not be accessed statically and `get_all()` is now called `getAll()'
'SilverStripe\Control\Session::clear_all()':
Expand All @@ -1336,10 +1307,6 @@ warnings:
message: 'Renamed to combineFiles'
replacement: 'combineFiles'
url: 'https://docs.silverstripe.org/en/4/changelogs/4.0.0#requirements'
'SilverStripe\View\Requirements_Backend->combine_js_with_min':
message: 'Renamed to $minifyCombinedFiles'
url: 'https://docs.silverstripe.org/en/4/changelogs/4.0.0#requirements'
replacement: 'minifyCombinedFiles'
'SilverStripe\View\Requirements_Backend->write_header_comments':
message: 'Renamed to writeHeaderComment'
url: 'https://docs.silverstripe.org/en/4/changelogs/4.0.0#requirements'
Expand All @@ -1350,12 +1317,6 @@ warnings:
replacement: 'writeJavascriptToBody'
'SilverStripe\Forms\Formfield->dontEscape':
message: 'FormField::$dontEscape has been removed. Escaping is now managed on a class by class basis.'
'SilverStripe\Security\LoginForm->authenticator_class':
message: 'authenticator_class is deprecated. Use getAuthenticatorClass/setAuthenticatorClass.'
'SilverStripe\Security\Permission->declared_permissions':
message: 'Deprecated'
'SilverStripe\Security\Permission->declared_permissions_list':
message: 'Deprecated'
functions:
'file_get_contents()':
message: 'Use new asset abstraction'
Expand Down Expand Up @@ -1428,8 +1389,6 @@ visibilities:
visibility: private
'SilverStripe\ORM\DataObject::default_classname':
visibility: private
'SilverStripe\ORM\DataObject->destroyed':
visibility: public
'SilverStripe\ORM\DataObject->record':
visibility: protected
'SilverStripe\ORM\DataObject->joinRecord':
Expand Down
5 changes: 0 additions & 5 deletions _config/backtrace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ SilverStripe\Dev\Backtrace:
- ['SilverStripe\Control\Middleware\ConfirmationMiddleware\GetParameter', buildConfirmationItem]
- ['SilverStripe\Control\Middleware\ConfirmationMiddleware\Url', buildConfirmationItem]
- ['SilverStripe\Control\Middleware\ConfirmationMiddleware\UrlPathStartswith', buildConfirmationItem]
- ['SilverStripe\Core\Startup\AbstractConfirmationToken', 'checkToken']
- ['SilverStripe\Core\Startup\AbstractConfirmationToken', 'pathForToken']
- ['SilverStripe\Core\Startup\AbstractConfirmationToken', 'prepare_tokens']
- ['SilverStripe\ORM\DB', 'connect']
- ['SilverStripe\ORM\DB', 'createDatabase']
- ['SilverStripe\Security\Confirmation\Item', '__construct']
Expand All @@ -33,9 +30,7 @@ SilverStripe\Dev\Backtrace:
- ['SilverStripe\Security\PasswordEncryptor_Blowfish', 'encryptY']
- ['SilverStripe\Security\PasswordValidator', 'validate']
- ['SilverStripe\Security\RememberLoginHash', 'setToken']
- ['SilverStripe\Security\Security', 'check_default_admin']
- ['SilverStripe\Security\Security', 'encrypt_password']
- ['SilverStripe\Security\Security', 'setDefaultAdmin']
- ['*', 'checkPassword']
- ['*', 'onAfterChangePassword']
- ['*', 'onBeforeChangePassword']
Expand Down
13 changes: 1 addition & 12 deletions _config/requestprocessors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ Name: requestprocessors
---
SilverStripe\Core\Injector\Injector:
SilverStripe\Control\Director:
# Note: Don't add 'class' config here, as it will affect ErrorDirector as well
# Note: Don't add 'class' config here
properties:
Middlewares:
TrustedProxyMiddleware: '%$SilverStripe\Control\Middleware\TrustedProxyMiddleware'
AllowedHostsMiddleware: '%$SilverStripe\Control\Middleware\AllowedHostsMiddleware'
SessionMiddleware: '%$SilverStripe\Control\Middleware\SessionMiddleware'
RequestProcessorMiddleware: '%$SilverStripe\Control\RequestProcessor'
FlushMiddleware: '%$SilverStripe\Control\Middleware\FlushMiddleware'
ChangeDetectionMiddleware: '%$SilverStripe\Control\Middleware\ChangeDetectionMiddleware'
HTTPCacheControleMiddleware: '%$SilverStripe\Control\Middleware\HTTPCacheControlMiddleware'
Expand All @@ -33,16 +32,6 @@ SilverStripe\Core\Injector\Injector:
Middlewares:
- '%$SecurityRateLimitMiddleware'

---
Name: errorrequestprocessors
After:
- '#requestprocessors'
---
SilverStripe\Core\Injector\Injector:
# Note: If Director config changes, take note it will affect this config too
SilverStripe\Core\Startup\ErrorDirector: '%$SilverStripe\Control\Director'


---
Name: canonicalurls
---
Expand Down
28 changes: 0 additions & 28 deletions src/Control/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

use SilverStripe\Core\ClassInfo;
use SilverStripe\Dev\Debug;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\Security\BasicAuth;
use SilverStripe\Security\BasicAuthMiddleware;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\View\SSViewer;
Expand Down Expand Up @@ -62,13 +59,6 @@ class Controller extends RequestHandler implements TemplateGlobalProvider
*/
protected $templates = [];

/**
* @deprecated 4.1.0:5.0.0 Add this controller's url to
* SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead of setting false
* @var bool
*/
protected $basicAuthEnabled = true;

/**
* The response object that the controller returns.
*
Expand Down Expand Up @@ -106,11 +96,6 @@ public function __construct()
*/
protected function init()
{
// @todo This will be removed in 5.0 and will be controlled by middleware instead
if ($this->basicAuthEnabled) {
BasicAuth::protect_site_if_necessary();
}

// This is used to test that subordinate controllers are actually calling parent::init() - a common bug
$this->baseInitCalled = true;
}
Expand Down Expand Up @@ -523,19 +508,6 @@ public function render($params = null)
return $template->process($obj);
}

/**
* Call this to disable site-wide basic authentication for a specific controller. This must be
* 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 Add this controller's url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead
*/
public function disableBasicAuth()
{
Deprecation::notice('4.1.0', 'Add this controller\'s url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead');
$this->basicAuthEnabled = false;
}

/**
* Returns the current controller.
*
Expand Down
1 change: 0 additions & 1 deletion src/Control/CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace SilverStripe\Control;

use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\FieldType\DBDatetime;
use LogicException;

Expand Down
43 changes: 2 additions & 41 deletions src/Control/Director.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Kernel;
use SilverStripe\Core\Path;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Versioned\Versioned;
use SilverStripe\View\Requirements;
use SilverStripe\View\Requirements_Backend;
Expand Down Expand Up @@ -375,34 +374,6 @@ public function handleRequest(HTTPRequest $request)
return $response;
}

/**
* Returns indication whether the manifest cache has been flushed
* in the beginning of the current request.
*
* That could mean the current active request has `?flush` parameter.
* Another possibility is a race condition when the current request
* hits the server in between another request `?flush` authorisation
* and a redirect to the actual flush.
*
* @return bool
*
* @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
// Introducing it to the Kernel interface is a breaking change
if (method_exists($kernel, 'isFlushed')) {
return $kernel->isFlushed();
}

$classManifest = $kernel->getClassLoader()->getManifest();
return $classManifest->isFlushed();
}

/**
* Return the {@link SiteTree} object that is currently being viewed. If there is no SiteTree
* object to return, then this will return the current controller.
Expand Down Expand Up @@ -433,19 +404,9 @@ public static function set_current_page($page)
* - BASE - Append this path to the base url (i.e. behaves as though `<base>` tag is provided in a html document). This is the default.
* - REQUEST - Resolve this path to the current url (i.e. behaves as though no `<base>` tag is provided in a html document)
* - ROOT - Treat this as though it was an absolute path, and append it to the protocol and hostname.
*
* @param string $url The url or path to resolve to absolute url.
* @param string $relativeParent Disambiguation method to use for evaluating relative paths
* @return string The absolute url
*/
public static function absoluteURL($url, $relativeParent = self::BASE)
public static function absoluteURL(string $url, string $relativeParent = self::BASE): string|bool
{
if (is_bool($relativeParent)) {
// Deprecate old boolean second parameter
Deprecation::notice('5.0', 'Director::absoluteURL takes an explicit parent for relative url');
$relativeParent = $relativeParent ? self::BASE : self::REQUEST;
}

// Check if there is already a protocol given
if (preg_match('/^http(s?):\/\//', $url ?? '')) {
return $url;
Expand Down Expand Up @@ -1151,7 +1112,7 @@ public static function get_template_global_variables()
'isLive',
'is_ajax',
'isAjax' => 'is_ajax',
'BaseHref' => 'absoluteBaseURL', //@deprecated 3.0
'BaseHref' => 'absoluteBaseURL',
];
}

Expand Down
16 changes: 0 additions & 16 deletions src/Control/Email/Mailer.php

This file was deleted.

Loading