share(function () use ($name, $version) { return new Console\Application($name, $version); }); $this['dispatcher']->addListener('phraseanet.notification.sent', function () use ($app) { $app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']); }); $this->register(new PluginServiceProvider()); $this->register(new ComposerSetupServiceProvider()); $this->register(new CLIDriversServiceProvider()); $this->register(new LessBuilderServiceProvider()); $this->register(new SignalHandlerServiceProvider()); $this->register(new TaskManagerServiceProvider()); $this->bindRoutes(); } /** * Executes this application. * * @param bool $interactive runs in an interactive shell if true. */ public function runCLI($interactive = false) { $app = $this['console']; if ($interactive) { $app = new Console\Shell($app); } $app->run(); } public function run(\Symfony\Component\HttpFoundation\Request $request = null) { $this->runCLI(); } /** * Adds a command object. * * If a command with the same name already exists, it will be overridden. * * @param CommandInterface $command A Command object */ public function command(CommandInterface $command) { $command->setContainer($this); $this['console']->add($command); } /** * {@inheritdoc} */ public function loadPlugins() { parent::loadPlugins(); call_user_func(function ($cli) { require $cli['plugins.directory'] . '/commands.php'; }, $this); } }