summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controller/CronjobController.php32
-rw-r--r--app/ServiceProvider/AuthenticationProvider.php1
-rw-r--r--app/ServiceProvider/RouteProvider.php3
3 files changed, 36 insertions, 0 deletions
diff --git a/app/Controller/CronjobController.php b/app/Controller/CronjobController.php
new file mode 100644
index 00000000..082fadfa
--- /dev/null
+++ b/app/Controller/CronjobController.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Kanboard\Controller;
+
+use Kanboard\Controller\BaseController;
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Output\NullOutput;
+
+/**
+ * Class CronjobController
+ *
+ * Runs cron jobs via URL
+ *
+ * @package Kanboard\Controller
+ */
+class CronjobController extends BaseController
+{
+ public function run()
+ {
+ $this->checkWebhookToken();
+
+ $input = new ArrayInput(array(
+ 'command' => 'cronjob',
+ ));
+ $output = new NullOutput();
+
+ $this->cli->setAutoExit(false);
+ $this->cli->run($input, $output);
+
+ $this->response->html('Cronjob executed');
+ }
+}
diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php
index 9cb437ac..40a62971 100644
--- a/app/ServiceProvider/AuthenticationProvider.php
+++ b/app/ServiceProvider/AuthenticationProvider.php
@@ -143,6 +143,7 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->add('FeedController', '*', Role::APP_PUBLIC);
$acl->add('AvatarFileController', array('show', 'image'), Role::APP_PUBLIC);
$acl->add('UserInviteController', array('signup', 'register'), Role::APP_PUBLIC);
+ $acl->add('CronjobController', array('run'), Role::APP_PUBLIC);
$acl->add('ConfigController', '*', Role::APP_ADMIN);
$acl->add('TagController', '*', Role::APP_ADMIN);
diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php
index 5b9eca98..66942188 100644
--- a/app/ServiceProvider/RouteProvider.php
+++ b/app/ServiceProvider/RouteProvider.php
@@ -180,6 +180,9 @@ class RouteProvider implements ServiceProviderInterface
// PasswordReset
$container['route']->addRoute('forgot-password', 'PasswordResetController', 'create');
$container['route']->addRoute('forgot-password/change/:token', 'PasswordResetController', 'change');
+
+ // Cronjob
+ $container['route']->addRoute('cronjob', 'CronjobController', 'run');
}
return $container;