summaryrefslogtreecommitdiffstats
path: root/lib/private/console/application.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-02-05 12:24:54 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2016-02-05 12:24:54 +0100
commit97b907335a5a681d5c7a096789a37011e69d01e5 (patch)
tree81648de27f20f83d994d6000240b299cbfed0382 /lib/private/console/application.php
parent0ed2108b7f3a8537643b89823d628e4db18ecf61 (diff)
downloadnextcloud-server-97b907335a5a681d5c7a096789a37011e69d01e5.tar.gz
nextcloud-server-97b907335a5a681d5c7a096789a37011e69d01e5.zip
Dispatch an event when a console command is run
Diffstat (limited to 'lib/private/console/application.php')
-rw-r--r--lib/private/console/application.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/private/console/application.php b/lib/private/console/application.php
index c7d9c24d7cb..10ff69b1c80 100644
--- a/lib/private/console/application.php
+++ b/lib/private/console/application.php
@@ -25,25 +25,34 @@ namespace OC\Console;
use OC_App;
use OC_Defaults;
+use OCP\Console\ConsoleEvent;
use OCP\IConfig;
+use OCP\IRequest;
use Symfony\Component\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class Application {
- /**
- * @var IConfig
- */
+ /** @var IConfig */
private $config;
+ /** @var EventDispatcherInterface */
+ private $dispatcher;
+ /** @var IRequest */
+ private $request;
/**
* @param IConfig $config
+ * @param EventDispatcherInterface $dispatcher
+ * @param IRequest $request
*/
- public function __construct(IConfig $config) {
+ public function __construct(IConfig $config, EventDispatcherInterface $dispatcher, IRequest $request) {
$defaults = new OC_Defaults;
$this->config = $config;
$this->application = new SymfonyApplication($defaults->getName(), \OC_Util::getVersionString());
+ $this->dispatcher = $dispatcher;
+ $this->request = $request;
}
/**
@@ -107,6 +116,10 @@ class Application {
* @throws \Exception
*/
public function run(InputInterface $input = null, OutputInterface $output = null) {
+ $this->dispatcher->dispatch(ConsoleEvent::EVENT_RUN, new ConsoleEvent(
+ ConsoleEvent::EVENT_RUN,
+ $this->request->server['argv']
+ ));
return $this->application->run($input, $output);
}
}