Add first, basic version of info command

This will hopefully help in debugging some problems.
This commit is contained in:
Franz Liedke 2016-03-20 23:12:20 +09:00
parent eef895c16f
commit 7e33690660
2 changed files with 60 additions and 0 deletions

View File

@ -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'));

View File

@ -0,0 +1,59 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* 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");
}
}
}