mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
add segment config var to buildtask
This commit is contained in:
parent
d9cffe5f53
commit
2e1eb4afad
@ -12,6 +12,14 @@
|
|||||||
*/
|
*/
|
||||||
abstract class BuildTask extends Object {
|
abstract class BuildTask extends Object {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom url segment (to follow dev/tasks/)
|
||||||
|
*
|
||||||
|
* @config
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private static $segment = 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.
|
||||||
|
@ -103,17 +103,18 @@ class TaskRunner extends Controller {
|
|||||||
// remove the base class
|
// remove the base class
|
||||||
array_shift($taskClasses);
|
array_shift($taskClasses);
|
||||||
|
|
||||||
if($taskClasses) foreach($taskClasses as $class) {
|
foreach($taskClasses as $class) {
|
||||||
if (!$this->taskEnabled($class)) continue;
|
if (!$this->taskEnabled($class)) continue;
|
||||||
|
$singleton = singleton($class);
|
||||||
|
|
||||||
$desc = (Director::is_cli())
|
$desc = (Director::is_cli())
|
||||||
? Convert::html2raw(singleton($class)->getDescription())
|
? Convert::html2raw($singleton->getDescription())
|
||||||
: singleton($class)->getDescription();
|
: $singleton->getDescription();
|
||||||
|
|
||||||
$availableTasks[] = array(
|
$availableTasks[] = array(
|
||||||
'class' => $class,
|
'class' => $class,
|
||||||
'title' => singleton($class)->getTitle(),
|
'title' => singleton($class)->getTitle(),
|
||||||
'segment' => str_replace('\\', '-', $class),
|
'segment' => $singleton->config()->segment ?: str_replace('\\', '-', $class),
|
||||||
'description' => $desc,
|
'description' => $desc,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user