summaryrefslogtreecommitdiff
path: root/app/ServiceProvider
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-29 20:33:48 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-29 20:33:48 -0400
commitfb642b76bb3d84b38c09f5d9dff8b51369eedaf2 (patch)
tree29331a2df63d259811e8dc70065ef8507998c1fe /app/ServiceProvider
parentb69eb5f99350a378387ab1f711d4fbe3bb3bddab (diff)
Make console commands pluggable
Diffstat (limited to 'app/ServiceProvider')
-rw-r--r--app/ServiceProvider/CommandProvider.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/app/ServiceProvider/CommandProvider.php b/app/ServiceProvider/CommandProvider.php
new file mode 100644
index 00000000..55c2712b
--- /dev/null
+++ b/app/ServiceProvider/CommandProvider.php
@@ -0,0 +1,62 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Kanboard\Console\CronjobCommand;
+use Kanboard\Console\LocaleComparatorCommand;
+use Kanboard\Console\LocaleSyncCommand;
+use Kanboard\Console\PluginInstallCommand;
+use Kanboard\Console\PluginUninstallCommand;
+use Kanboard\Console\PluginUpgradeCommand;
+use Kanboard\Console\ProjectDailyColumnStatsExportCommand;
+use Kanboard\Console\ProjectDailyStatsCalculationCommand;
+use Kanboard\Console\ResetPasswordCommand;
+use Kanboard\Console\ResetTwoFactorCommand;
+use Kanboard\Console\SubtaskExportCommand;
+use Kanboard\Console\TaskExportCommand;
+use Kanboard\Console\TaskOverdueNotificationCommand;
+use Kanboard\Console\TaskTriggerCommand;
+use Kanboard\Console\TransitionExportCommand;
+use Kanboard\Console\WorkerCommand;
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Symfony\Component\Console\Application;
+
+/**
+ * Class CommandProvider
+ *
+ * @package Kanboard\ServiceProvider
+ * @author Frederic Guillot
+ */
+class CommandProvider implements ServiceProviderInterface
+{
+ /**
+ * Registers services on the given container.
+ *
+ * @param Container $container
+ * @return Container
+ */
+ public function register(Container $container)
+ {
+ $application = new Application('Kanboard', APP_VERSION);
+ $application->add(new TaskOverdueNotificationCommand($container));
+ $application->add(new SubtaskExportCommand($container));
+ $application->add(new TaskExportCommand($container));
+ $application->add(new ProjectDailyStatsCalculationCommand($container));
+ $application->add(new ProjectDailyColumnStatsExportCommand($container));
+ $application->add(new TransitionExportCommand($container));
+ $application->add(new LocaleSyncCommand($container));
+ $application->add(new LocaleComparatorCommand($container));
+ $application->add(new TaskTriggerCommand($container));
+ $application->add(new CronjobCommand($container));
+ $application->add(new WorkerCommand($container));
+ $application->add(new ResetPasswordCommand($container));
+ $application->add(new ResetTwoFactorCommand($container));
+ $application->add(new PluginUpgradeCommand($container));
+ $application->add(new PluginInstallCommand($container));
+ $application->add(new PluginUninstallCommand($container));
+
+ $container['cli'] = $application;
+ return $container;
+ }
+}