From 35a3a8fafe8db7ec127d258f688e3b931d76044e Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Mon, 28 May 2018 10:52:03 +1200 Subject: [PATCH 1/2] Revert merged up semver violations --- _config/taskrunner.yml | 11 --- changelog.md | 29 ------ src/Controllers/QueuedTaskRunner.php | 141 --------------------------- src/Jobs/RunBuildTaskJob.php | 78 --------------- src/Tasks/DeleteAllJobsTask.php | 54 ---------- 5 files changed, 313 deletions(-) delete mode 100644 _config/taskrunner.yml delete mode 100644 changelog.md delete mode 100644 src/Controllers/QueuedTaskRunner.php delete mode 100644 src/Jobs/RunBuildTaskJob.php delete mode 100644 src/Tasks/DeleteAllJobsTask.php diff --git a/_config/taskrunner.yml b/_config/taskrunner.yml deleted file mode 100644 index 7cdfa26b..00000000 --- a/_config/taskrunner.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -Name: QueuedDevelopmentAdmin -After: - - DevelopmentAdmin ---- -SilverStripe\Dev\DevelopmentAdmin: - registered_controllers: - tasks: - controller: Symbiote\QueuedJobs\Controllers\QueuedTaskRunner - links: - tasks: 'See a list of build tasks to run (QueuedJobs version)' diff --git a/changelog.md b/changelog.md deleted file mode 100644 index 065f0267..00000000 --- a/changelog.md +++ /dev/null @@ -1,29 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -This project adheres to [Semantic Versioning](http://semver.org/). - -## 3.0.0 (unreleased) - -Minimum versions: - -* SilverStripe: 4+ -* PHP: 5.5+ -* PHP 7 supported - -## [2.8.5] - -* Update translations. -* Remove CMS from composer dependencies. -* Fix reference to queued job admin email -* BUG Remove invalid backtraces from errcontext -* Fix long job cron example in readme -* Updating the "travis" build reference. - -## [2.8.4] - -* Readded function to list current jobs in ProcessJobQueueTask -* Typo in queueRunner property -* BUG Fix error logging passing invalid errcontext -* Changelog added diff --git a/src/Controllers/QueuedTaskRunner.php b/src/Controllers/QueuedTaskRunner.php deleted file mode 100644 index 2f72c2a2..00000000 --- a/src/Controllers/QueuedTaskRunner.php +++ /dev/null @@ -1,141 +0,0 @@ - 'queueTask' - ); - - private static $allowed_actions = array( - 'queueTask' - ); - - private static $task_blacklist = array( - ProcessJobQueueTask::class, - ProcessJobQueueChildTask::class, - CreateQueuedJobTask::class, - DeleteAllJobsTask::class, - ); - - public function index() - { - $tasks = $this->getTasks(); - - $blacklist = (array)$this->config()->task_blacklist; - $backlistedTasks = array(); - - // Web mode - if(!Director::is_cli()) { - $renderer = new DebugView(); - echo $renderer->renderHeader(); - echo $renderer->renderInfo("SilverStripe Development Tools: Tasks (QueuedJobs version)", Director::absoluteBaseURL()); - $base = Director::absoluteBaseURL(); - - echo "
"; - echo "

Queueable jobs

\n"; - echo "

By default these jobs will be added the job queue, rather than run immediately

\n"; - echo "
"; - - echo "
"; - echo "

Non-queueable tasks

\n"; - echo "

These tasks shouldn't be added the queuejobs queue, but you can run them immediately.

\n"; - echo "
"; - - echo $renderer->renderFooter(); - - // CLI mode - revert to default behaviour - } else { - return parent::index(); - } - } - - - /** - * Adds a RunBuildTaskJob to the job queue for a given task - * @param HTTPRequest $request - */ - public function queueTask($request) - { - $name = $request->param('TaskName'); - $tasks = $this->getTasks(); - - $variables = $request->getVars(); - unset($variables['url']); - unset($variables['flush']); - unset($variables['flushtoken']); - unset($variables['isDev']); - $querystring = http_build_query($variables); - - $title = function ($content) { - printf(Director::is_cli() ? "%s\n\n" : '

%s

', $content); - }; - - $message = function ($content) { - printf(Director::is_cli() ? "%s\n" : '

%s

', $content); - }; - - foreach ($tasks as $task) { - if ($task['segment'] == $name) { - /** @var BuildTask $inst */ - $inst = Injector::inst()->create($task['class']); - if (!$inst->isEnabled()) { - $message('The task is disabled'); - return; - } - - $title(sprintf('Queuing Task %s', $inst->getTitle())); - - $job = new RunBuildTaskJob($task['class'], $querystring); - $jobID = Injector::inst()->get(QueuedJobService::class)->queueJob($job); - - $message('Done: queued with job ID ' . $jobID); - $adminLink = Director::baseURL() . "admin/queuedjobs/" . str_replace('\\', '-', QueuedJobDescriptor::class); - $message("Visit queued jobs admin to see job status"); - return; - } - } - - $message(sprintf('The build task "%s" could not be found', Convert::raw2xml($name))); - } -} diff --git a/src/Jobs/RunBuildTaskJob.php b/src/Jobs/RunBuildTaskJob.php deleted file mode 100644 index 23095f6c..00000000 --- a/src/Jobs/RunBuildTaskJob.php +++ /dev/null @@ -1,78 +0,0 @@ -TaskClass = $taskClass; - } - - if ($queryString) { - $this->QueryString = $queryString; - } - - $this->currentStep = 0; - $this->totalSteps = 1; - } - - /** - * @param string (default: Object) - * @return DataObject - */ - protected function getObject($name = 'SilverStripe\\Core\\Object') { - return DataObject::get_by_id($this->TargetClass, $this->TargetID); - } - - /** - * @return string - */ - public function getJobType() { - return QueuedJob::QUEUED; - } - - /** - * @return string - */ - public function getTitle() { - $taskName = $this->QueryString ? ($this->TaskClass . '?' . $this->QueryString) : $this->TaskClass; - return _t('RunBuildTaskJob.JOB_TITLE', 'Run BuildTask {task}', array('task' => $taskName)); - } - - public function process() { - if (!is_subclass_of($this->TaskClass, BuildTask::class)) { - throw new \LogicException($this->TaskClass . ' is not a build task'); - } - - $task = Injector::inst()->create($this->TaskClass); - if (!$task->isEnabled()) { - throw new \LogicException($this->TaskClass . ' is not enabled'); - } - - $getVars = array(); - parse_str($this->QueryString, $getVars); - $request = new HTTPRequest('GET', '/', $getVars); - $task->run($request); - - $this->currentStep = 1; - $this->isComplete = true; - } -} diff --git a/src/Tasks/DeleteAllJobsTask.php b/src/Tasks/DeleteAllJobsTask.php deleted file mode 100644 index a95e783d..00000000 --- a/src/Tasks/DeleteAllJobsTask.php +++ /dev/null @@ -1,54 +0,0 @@ -getVar('confirm'); - - $jobs = DataObject::get(QueuedJobDescriptor::class); - - if (!$confirm) { - echo "Really delete " . $jobs->count() . " jobs? Please add ?confirm=1 to the URL to confirm."; - return; - } - - echo "Deleting " . $jobs->count() . " jobs...
\n"; - $jobs->removeAll(); - echo "Done."; - } -} From 40cc7650f9cf63573ed2d71accedced4666f340f Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Mon, 28 May 2018 11:05:59 +1200 Subject: [PATCH 2/2] Remove branch alias --- composer.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/composer.json b/composer.json index ac480753..a88dadbd 100644 --- a/composer.json +++ b/composer.json @@ -25,11 +25,7 @@ }, "minimum-stability": "dev", "prefer-stable": true, - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, + "extra": [], "replace": { "silverstripe/queuedjobs": "self.version" },