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

Various deprecations and a few features #11365

Merged

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Sep 10, 2024

The commits in this PR are intentionally separated, do not squash.

  1. Deprecate DatabaselessKernel and merge that functionality into CoreKernel instead - and add BaseKernel::getBooted() (see src/Cli/Sake.php)
  2. Implement two new methods for ArrayLib (see src/Cli/LegacyParamArgvInput.php)
  3. Implement a new method for DBDateTime (see src/Dev/BuildTask.php)
  4. Various deprecations for stuff that's getting deleted in NEW Refactor CLI interaction with Silverstripe app #11353

Makes sense to add the non-API-breaking new features into this minor instead of having it in the 6 PR.

Issues

Copy link
Member Author

@GuySartorelli GuySartorelli Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a way to unit test this, unfortunately, since the kernel gets booted as part of unit tests before we get a chance to set this

protected function getRegisteredController($baseUrlPart)
{
Deprecation::notice('5.4.0', 'Will be removed without equivalent functionality to replace it');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to wrap in withNotReplacement()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? It's not called from anywhere?

public function __construct()
{
parent::__construct();
Deprecation::notice('5.4.0', 'Will be replaced with symfony/console commands', Deprecation::SCOPE_CLASS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to wrap in withNoReplacement as there's no replacement in CMS 5

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? We don't use this anywhere?

/**
* Get the amount of time inbetween two datetimes.
*/
public static function getTimeBetween(DBDateTime $from, DBDateTime $to): string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being added?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the PR description

Comment on lines +210 to +222
*
* @deprecated 5.4.0 Will be replaced with SilverStripe\Dev\Command\DbBuild::lastBuilt()
*/
public static function lastBuilt()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'5.4.0',
'Will be replaced with SilverStripe\Dev\Command\DbBuild::lastBuilt()'
);
});

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*
* @deprecated 5.4.0 Will be replaced with SilverStripe\Dev\Command\DbBuild::lastBuilt()
*/
public static function lastBuilt()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'5.4.0',
'Will be replaced with SilverStripe\Dev\Command\DbBuild::lastBuilt()'
);
});
*/
public static function lastBuilt()
{

Class is already deprecated and method name will be the same

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a static method. It's possible to call this method without instantiating the class, which means we need a deprecation warning in the method itself.

@@ -55,9 +59,22 @@ class DatabaseAdmin extends Controller

/**
* Config setting to enabled/disable the display of record counts on the dev/build output
* @deprecated 5.4.0 Will be replaced with SilverStripe\Dev\Command\DbBuild.show_record_counts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @deprecated 5.4.0 Will be replaced with SilverStripe\Dev\Command\DbBuild.show_record_counts

Class is already deprecated and property is the same name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion can be in #11365 (comment) given config is effectively the same as a static method.

@@ -38,6 +41,7 @@ class DatabaseAdmin extends Controller

/**
* Obsolete classname values that should be remapped in dev/build
* @deprecated 5.4.0 Will be replaced with SilverStripe\Dev\Command\DbBuild.classname_value_remapping
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @deprecated 5.4.0 Will be replaced with SilverStripe\Dev\Command\DbBuild.classname_value_remapping

Class is already deprecated and property is the same name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion can be in #11365 (comment)

@GuySartorelli
Copy link
Member Author

Rebased to resolve conflict

@emteknetnz emteknetnz merged commit 6a3659d into silverstripe:5 Sep 13, 2024
14 checks passed
@emteknetnz emteknetnz deleted the pulls/5/cms5-for-sakesymfony branch September 13, 2024 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants