mirror of
https://github.com/flarum/core.git
synced 2025-08-03 23:17:43 +02:00
Add console extender (#2057)
* Made the console command system extender-friendly * Added console extender * Added ConsoleTestCase to integration tests * Added integration tests for console extender * Marked event-based console extension system as deprecated * Moved trimming command output of whitespace into superclass * Renamed 'add' to 'command' * Added special processing for laravel commands * Code style fixes * More style fixes * Fixed $this->container
This commit is contained in:
committed by
GitHub
parent
03a4997a1c
commit
345ad4bc6d
@@ -9,13 +9,10 @@
|
||||
|
||||
namespace Flarum\Foundation;
|
||||
|
||||
use Flarum\Database\Console\GenerateMigrationCommand;
|
||||
use Flarum\Database\Console\MigrateCommand;
|
||||
use Flarum\Database\Console\ResetCommand;
|
||||
use Flarum\Foundation\Console\CacheClearCommand;
|
||||
use Flarum\Foundation\Console\InfoCommand;
|
||||
use Flarum\Http\Middleware\DispatchRoute;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Laminas\Stratigility\Middleware\OriginalMessages;
|
||||
use Laminas\Stratigility\MiddlewarePipe;
|
||||
@@ -115,12 +112,21 @@ class InstalledApp implements AppInterface
|
||||
*/
|
||||
public function getConsoleCommands()
|
||||
{
|
||||
return [
|
||||
$this->container->make(GenerateMigrationCommand::class),
|
||||
$this->container->make(InfoCommand::class, ['config' => $this->config]),
|
||||
$this->container->make(MigrateCommand::class),
|
||||
$this->container->make(ResetCommand::class),
|
||||
$this->container->make(CacheClearCommand::class),
|
||||
];
|
||||
$commands = [];
|
||||
|
||||
// The info command is a special case, as it requires a config parameter that's only available here.
|
||||
$commands[] = $this->container->make(InfoCommand::class, ['config' => $this->config]);
|
||||
|
||||
foreach ($this->container->make('flarum.console.commands') as $command) {
|
||||
$newCommand = $this->container->make($command);
|
||||
|
||||
if ($newCommand instanceof Command) {
|
||||
$newCommand->setLaravel($this->container);
|
||||
}
|
||||
|
||||
$commands[] = $newCommand;
|
||||
}
|
||||
|
||||
return $commands;
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ namespace Flarum\Foundation;
|
||||
use Flarum\Admin\AdminServiceProvider;
|
||||
use Flarum\Api\ApiServiceProvider;
|
||||
use Flarum\Bus\BusServiceProvider;
|
||||
use Flarum\Console\ConsoleServiceProvider;
|
||||
use Flarum\Database\DatabaseServiceProvider;
|
||||
use Flarum\Database\MigrationServiceProvider;
|
||||
use Flarum\Discussion\DiscussionServiceProvider;
|
||||
@@ -113,6 +114,7 @@ class InstalledSite implements SiteInterface
|
||||
$laravel->register(AdminServiceProvider::class);
|
||||
$laravel->register(ApiServiceProvider::class);
|
||||
$laravel->register(BusServiceProvider::class);
|
||||
$laravel->register(ConsoleServiceProvider::class);
|
||||
$laravel->register(DatabaseServiceProvider::class);
|
||||
$laravel->register(DiscussionServiceProvider::class);
|
||||
$laravel->register(ExtensionServiceProvider::class);
|
||||
|
Reference in New Issue
Block a user