Silverstripe-framework: Namespaced BuildTasks should be able to define a simpler URL

Created on 23 Jan 2017  路  7Comments  路  Source: silverstripe/silverstripe-framework

When creating a new BuildTask, the URL used to run the task is auto-generated based on the ClassName. However, with the introduction of namespacing, this means you end up with clunky URLs such as:

mysite.example.com/dev/tasks/andante-newproject-americasnexttopmodule-tasks-StillInTheRunningTask

I think there should be the ability to set the command URL, something like:

public function getCommandURL()
{
  return "StillInTheRunningTask";
}

Which appends it to dev/tasks.

affectv3

All 7 comments

Makes sense to me! How would we deal with (incredibly unlikely) conflicts? Perhaps if it鈥檚 a config variable it would be easier to fix if you were to encounter that?

Yep, config variable makes sense. I don't think resolving conflicts needs to be automatic - we'd want to throw some sort of error if a conflict came about, not sure where or how though. At the moment I suppose we'd have a class-clash error.

My preference is to fail to run either task, log an error and allow override via config (in case you clash with a module or something like that).

@andrewandante you can define private static $segment = 'StillInTheRunningTask'; to achieve this. This should be more prominently placed in the changelog/upgrade guide.

P.s. Nice namespace :)

Awesome! Well there you go. Thanks @robbieaverill

@andrewandante do you want to backport this to 3.x or shall we close?

I'll backport it. Seems a good thing to have, and will make upgrading from 3 to 4 easier for existing projects.

馃憤 for better NS support in 3.x!

Was this page helpful?
0 / 5 - 0 ratings