diff --git a/src/Console/Server.php b/src/Console/Server.php index 32fe3e29f..1b86c328f 100644 --- a/src/Console/Server.php +++ b/src/Console/Server.php @@ -36,6 +36,7 @@ class Server extends AbstractServer $console->add($app->make('Flarum\Install\Console\InstallCommand')); $console->add($app->make('Flarum\Update\Console\MigrateCommand')); + $console->add($app->make('Flarum\Debug\Console\InfoCommand')); $console->add($app->make('Flarum\Console\Command\GenerateExtensionCommand')); $console->add($app->make('Flarum\Console\Command\GenerateMigrationCommand')); diff --git a/src/Debug/Console/InfoCommand.php b/src/Debug/Console/InfoCommand.php new file mode 100644 index 000000000..f0a616def --- /dev/null +++ b/src/Debug/Console/InfoCommand.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Flarum\Debug\Console; + +use Flarum\Console\Command\AbstractCommand; +use Flarum\Extension\ExtensionManager; +use Flarum\Foundation\Application; + +class InfoCommand extends AbstractCommand +{ + /** + * @var ExtensionManager + */ + protected $extensions; + + /** + * @param ExtensionManager $extensions + */ + public function __construct(ExtensionManager $extensions) + { + $this->extensions = $extensions; + + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('info') + ->setDescription("Gather information about Flarum's core and installed extensions"); + } + + /** + * {@inheritdoc} + */ + protected function fire() + { + $this->info('Flarum core '.Application::VERSION); + + foreach ($this->extensions->getEnabledExtensions() as $extension) { + /** @var \Flarum\Extension\Extension $extension */ + $name = $extension->getId(); + $version = $extension->getVersion(); + + $this->info("EXT $name $version"); + } + } +}