mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Adjust isEnabled method (#10801)
* Adjust isEnabled method to use config values if present, adjust dev.yml to have a default_enabled key, add is_enabled as a private property for deprecation in cms 6 * remove default_enabled flag again, adjust comments as suggested, remove method signature from isEnabled, fix typo, adjust logic and add fallback value for isEnabled as true * adjust isEnabled method, change static:: to ->enabled as the property is not actually static --------- Co-authored-by: Kevin Gröger <k.groeger@headtrip.eu>
This commit is contained in:
parent
86917ce291
commit
30cd4047df
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\Dev;
|
namespace SilverStripe\Dev;
|
||||||
|
|
||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Config\Configurable;
|
use SilverStripe\Core\Config\Configurable;
|
||||||
use SilverStripe\Core\Extensible;
|
use SilverStripe\Core\Extensible;
|
||||||
use SilverStripe\Core\Injector\Injectable;
|
use SilverStripe\Core\Injector\Injectable;
|
||||||
@ -32,9 +33,16 @@ abstract class BuildTask
|
|||||||
*/
|
*/
|
||||||
private static $segment = null;
|
private static $segment = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make this non-nullable and change this to `bool` in CMS6 with a value of `true`
|
||||||
|
* @var bool|null
|
||||||
|
*/
|
||||||
|
private static ?bool $is_enabled = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool $enabled If set to FALSE, keep it from showing in the list
|
* @var bool $enabled If set to FALSE, keep it from showing in the list
|
||||||
* and from being executable through URL or CLI.
|
* and from being executable through URL or CLI.
|
||||||
|
* @deprecated - remove in CMS 6 and rely on $is_enabled instead
|
||||||
*/
|
*/
|
||||||
protected $enabled = true;
|
protected $enabled = true;
|
||||||
|
|
||||||
@ -64,7 +72,12 @@ abstract class BuildTask
|
|||||||
*/
|
*/
|
||||||
public function isEnabled()
|
public function isEnabled()
|
||||||
{
|
{
|
||||||
return $this->enabled;
|
$isEnabled = $this->config()->get('is_enabled');
|
||||||
|
|
||||||
|
if ($isEnabled === null) {
|
||||||
|
return $this->enabled;
|
||||||
|
}
|
||||||
|
return $isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user