diff --git a/src/Illuminate/Cache/CacheServiceProvider.php b/src/Illuminate/Cache/CacheServiceProvider.php index 91892b4f1460..8eb5ed60ada6 100755 --- a/src/Illuminate/Cache/CacheServiceProvider.php +++ b/src/Illuminate/Cache/CacheServiceProvider.php @@ -3,8 +3,6 @@ namespace Illuminate\Cache; use Illuminate\Support\ServiceProvider; -use Illuminate\Cache\Console\ClearCommand; -use Illuminate\Cache\Console\ForgetCommand; class CacheServiceProvider extends ServiceProvider { @@ -33,28 +31,6 @@ public function register() $this->app->singleton('memcached.connector', function () { return new MemcachedConnector; }); - - $this->registerCommands(); - } - - /** - * Register the cache related console commands. - * - * @return void - */ - public function registerCommands() - { - $this->app->singleton('command.cache.clear', function ($app) { - return new ClearCommand($app['cache']); - }); - - $this->commands('command.cache.clear'); - - $this->app->singleton('command.cache.forget', function ($app) { - return new ForgetCommand($app['cache']); - }); - - $this->commands('command.cache.forget'); } /** @@ -66,7 +42,6 @@ public function provides() { return [ 'cache', 'cache.store', 'memcached.connector', - 'command.cache.clear', 'command.cache.forget', ]; } } diff --git a/src/Illuminate/Console/ScheduleServiceProvider.php b/src/Illuminate/Console/ScheduleServiceProvider.php deleted file mode 100644 index c0ef75fd7505..000000000000 --- a/src/Illuminate/Console/ScheduleServiceProvider.php +++ /dev/null @@ -1,41 +0,0 @@ -commands([ - 'Illuminate\Console\Scheduling\ScheduleRunCommand', - 'Illuminate\Console\Scheduling\ScheduleFinishCommand', - ]); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - 'Illuminate\Console\Scheduling\ScheduleRunCommand', - 'Illuminate\Console\Scheduling\ScheduleFinishCommand', - ]; - } -} diff --git a/src/Illuminate/Database/MigrationServiceProvider.php b/src/Illuminate/Database/MigrationServiceProvider.php index c5319541f059..a8b92ab6e481 100755 --- a/src/Illuminate/Database/MigrationServiceProvider.php +++ b/src/Illuminate/Database/MigrationServiceProvider.php @@ -5,12 +5,6 @@ use Illuminate\Support\ServiceProvider; use Illuminate\Database\Migrations\Migrator; use Illuminate\Database\Migrations\MigrationCreator; -use Illuminate\Database\Console\Migrations\ResetCommand; -use Illuminate\Database\Console\Migrations\StatusCommand; -use Illuminate\Database\Console\Migrations\InstallCommand; -use Illuminate\Database\Console\Migrations\MigrateCommand; -use Illuminate\Database\Console\Migrations\RefreshCommand; -use Illuminate\Database\Console\Migrations\RollbackCommand; use Illuminate\Database\Migrations\DatabaseMigrationRepository; class MigrationServiceProvider extends ServiceProvider @@ -31,14 +25,9 @@ public function register() { $this->registerRepository(); - // Once we have registered the migrator instance we will go ahead and register - // all of the migration related commands that are used by the "Artisan" CLI - // so that they may be easily accessed for registering with the consoles. $this->registerMigrator(); $this->registerCreator(); - - $this->registerCommands(); } /** @@ -84,105 +73,6 @@ protected function registerCreator() }); } - /** - * Register all of the migration commands. - * - * @return void - */ - protected function registerCommands() - { - $commands = ['Migrate', 'Rollback', 'Reset', 'Refresh', 'Install', 'Status']; - - // We'll simply spin through the list of commands that are migration related - // and register each one of them with an application container. They will - // be resolved in the Artisan start file and registered on the console. - foreach ($commands as $command) { - $this->{'register'.$command.'Command'}(); - } - - // Once the commands are registered in the application IoC container we will - // register them with the Artisan start event so that these are available - // when the Artisan application actually starts up and is getting used. - $this->commands( - 'command.migrate', - 'command.migrate.install', 'command.migrate.rollback', - 'command.migrate.reset', 'command.migrate.refresh', - 'command.migrate.status' - ); - } - - /** - * Register the "migrate" migration command. - * - * @return void - */ - protected function registerMigrateCommand() - { - $this->app->singleton('command.migrate', function ($app) { - return new MigrateCommand($app['migrator']); - }); - } - - /** - * Register the "rollback" migration command. - * - * @return void - */ - protected function registerRollbackCommand() - { - $this->app->singleton('command.migrate.rollback', function ($app) { - return new RollbackCommand($app['migrator']); - }); - } - - /** - * Register the "reset" migration command. - * - * @return void - */ - protected function registerResetCommand() - { - $this->app->singleton('command.migrate.reset', function ($app) { - return new ResetCommand($app['migrator']); - }); - } - - /** - * Register the "refresh" migration command. - * - * @return void - */ - protected function registerRefreshCommand() - { - $this->app->singleton('command.migrate.refresh', function () { - return new RefreshCommand; - }); - } - - /** - * Register the "status" migration command. - * - * @return void - */ - protected function registerStatusCommand() - { - $this->app->singleton('command.migrate.status', function ($app) { - return new StatusCommand($app['migrator']); - }); - } - - /** - * Register the "install" migration command. - * - * @return void - */ - protected function registerInstallCommand() - { - $this->app->singleton('command.migrate.install', function ($app) { - return new InstallCommand($app['migration.repository']); - }); - } - /** * Get the services provided by the provider. * @@ -191,10 +81,7 @@ protected function registerInstallCommand() public function provides() { return [ - 'migrator', 'migration.repository', 'command.migrate', - 'command.migrate.rollback', 'command.migrate.reset', - 'command.migrate.refresh', 'command.migrate.install', - 'command.migrate.status', 'migration.creator', + 'migrator', 'migration.repository', 'migration.creator', ]; } } diff --git a/src/Illuminate/Database/SeedServiceProvider.php b/src/Illuminate/Database/SeedServiceProvider.php deleted file mode 100755 index e58327ab2411..000000000000 --- a/src/Illuminate/Database/SeedServiceProvider.php +++ /dev/null @@ -1,50 +0,0 @@ -registerSeedCommand(); - - $this->commands('command.seed'); - } - - /** - * Register the seed console command. - * - * @return void - */ - protected function registerSeedCommand() - { - $this->app->singleton('command.seed', function ($app) { - return new SeedCommand($app['db']); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['seeder', 'command.seed']; - } -} diff --git a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php index d4bd678ba2a8..d8e37d320126 100755 --- a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -17,6 +17,7 @@ use Illuminate\Foundation\Console\MailMakeCommand; use Illuminate\Foundation\Console\OptimizeCommand; use Illuminate\Foundation\Console\TestMakeCommand; +use Illuminate\Database\Console\Seeds\SeedCommand; use Illuminate\Foundation\Console\EventMakeCommand; use Illuminate\Foundation\Console\ModelMakeCommand; use Illuminate\Foundation\Console\RouteListCommand; @@ -40,9 +41,24 @@ use Illuminate\Foundation\Console\EventGenerateCommand; use Illuminate\Foundation\Console\VendorPublishCommand; use Illuminate\Database\Console\Seeds\SeederMakeCommand; +use Illuminate\Database\Console\Migrations\MigrateCommand; use Illuminate\Foundation\Console\NotificationMakeCommand; +use Illuminate\Queue\Console\WorkCommand as QueueWorkCommand; use Illuminate\Database\Console\Migrations\MigrateMakeCommand; use Illuminate\Notifications\Console\NotificationTableCommand; +use Illuminate\Cache\Console\ClearCommand as CacheClearCommand; +use Illuminate\Queue\Console\RetryCommand as QueueRetryCommand; +use Illuminate\Cache\Console\ForgetCommand as CacheForgetCommand; +use Illuminate\Queue\Console\ListenCommand as QueueListenCommand; +use Illuminate\Queue\Console\RestartCommand as QueueRestartCommand; +use Illuminate\Queue\Console\ListFailedCommand as ListFailedQueueCommand; +use Illuminate\Queue\Console\FlushFailedCommand as FlushFailedQueueCommand; +use Illuminate\Queue\Console\ForgetFailedCommand as ForgetFailedQueueCommand; +use Illuminate\Database\Console\Migrations\ResetCommand as MigrateResetCommand; +use Illuminate\Database\Console\Migrations\StatusCommand as MigrateStatusCommand; +use Illuminate\Database\Console\Migrations\InstallCommand as MigrateInstallCommand; +use Illuminate\Database\Console\Migrations\RefreshCommand as MigrateRefreshCommand; +use Illuminate\Database\Console\Migrations\RollbackCommand as MigrateRollbackCommand; class ArtisanServiceProvider extends ServiceProvider { @@ -59,6 +75,8 @@ class ArtisanServiceProvider extends ServiceProvider * @var array */ protected $commands = [ + 'CacheClear' => 'command.cache.clear', + 'CacheForget' => 'command.cache.forget', 'ClearCompiled' => 'command.clear-compiled', 'ClearResets' => 'command.auth.resets.clear', 'ConfigCache' => 'command.config.cache', @@ -66,10 +84,26 @@ class ArtisanServiceProvider extends ServiceProvider 'Down' => 'command.down', 'Environment' => 'command.environment', 'KeyGenerate' => 'command.key.generate', + 'Migrate' => 'command.migrate', + 'MigrateInstall' => 'command.migrate.install', + 'MigrateRefresh' => 'command.migrate.refresh', + 'MigrateReset' => 'command.migrate.reset', + 'MigrateRollback' => 'command.migrate.rollback', + 'MigrateStatus' => 'command.migrate.status', 'Optimize' => 'command.optimize', + 'QueueFailed' => 'command.queue.failed', + 'QueueFlush' => 'command.queue.flush', + 'QueueForget' => 'command.queue.forget', + 'QueueListen' => 'command.queue.listen', + 'QueueRestart' => 'command.queue.restart', + 'QueueRetry' => 'command.queue.retry', + 'QueueWork' => 'command.queue.work', 'RouteCache' => 'command.route.cache', 'RouteClear' => 'command.route.clear', 'RouteList' => 'command.route.list', + 'Seed' => 'command.seed', + 'ScheduleFinish' => 'Illuminate\Console\Scheduling\ScheduleFinishCommand', + 'ScheduleRun' => 'Illuminate\Console\Scheduling\ScheduleRunCommand', 'StorageLink' => 'command.storage.link', 'Tinker' => 'command.tinker', 'Up' => 'command.up', @@ -160,6 +194,31 @@ protected function registerAuthMakeCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerCacheClearCommand() + { + $this->app->singleton('command.cache.clear', function ($app) { + return new CacheClearCommand($app['cache']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerCacheForgetCommand() + { + $this->app->singleton('command.cache.forget', function ($app) { + return new CacheForgetCommand($app['cache']); + }); + } + + /** * Register the command. * @@ -352,6 +411,30 @@ protected function registerMiddlewareMakeCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateCommand() + { + $this->app->singleton('command.migrate', function ($app) { + return new MigrateCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateInstallCommand() + { + $this->app->singleton('command.migrate.install', function ($app) { + return new MigrateInstallCommand($app['migration.repository']); + }); + } + /** * Register the command. * @@ -371,6 +454,54 @@ protected function registerMigrateMakeCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateRefreshCommand() + { + $this->app->singleton('command.migrate.refresh', function () { + return new MigrateRefreshCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateResetCommand() + { + $this->app->singleton('command.migrate.reset', function ($app) { + return new MigrateResetCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateRollbackCommand() + { + $this->app->singleton('command.migrate.rollback', function ($app) { + return new MigrateRollbackCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateStatusCommand() + { + $this->app->singleton('command.migrate.status', function ($app) { + return new MigrateStatusCommand($app['migrator']); + }); + } + /** * Register the command. * @@ -419,6 +550,90 @@ protected function registerProviderMakeCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerQueueFailedCommand() + { + $this->app->singleton('command.queue.failed', function () { + return new ListFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueForgetCommand() + { + $this->app->singleton('command.queue.forget', function () { + return new ForgetFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueFlushCommand() + { + $this->app->singleton('command.queue.flush', function () { + return new FlushFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueListenCommand() + { + $this->app->singleton('command.queue.listen', function ($app) { + return new QueueListenCommand($app['queue.listener']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueRestartCommand() + { + $this->app->singleton('command.queue.restart', function () { + return new QueueRestartCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueRetryCommand() + { + $this->app->singleton('command.queue.retry', function () { + return new QueueRetryCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueWorkCommand() + { + $this->app->singleton('command.queue.work', function ($app) { + return new QueueWorkCommand($app['queue.worker']); + }); + } + /** * Register the command. * @@ -527,6 +742,38 @@ protected function registerRouteListCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerSeedCommand() + { + $this->app->singleton('command.seed', function ($app) { + return new SeedCommand($app['db']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerScheduleFinishCommand() + { + $this->app->singleton('Illuminate\Console\Scheduling\ScheduleFinishCommand'); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerScheduleRunCommand() + { + $this->app->singleton('Illuminate\Console\Scheduling\ScheduleRunCommand'); + } + /** * Register the command. * diff --git a/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php b/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php index 8a1ea75c7ab5..e4b23ca13d49 100644 --- a/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php @@ -20,10 +20,7 @@ class ConsoleSupportServiceProvider extends AggregateServiceProvider */ protected $providers = [ 'Illuminate\Foundation\Providers\ArtisanServiceProvider', - 'Illuminate\Console\ScheduleServiceProvider', 'Illuminate\Database\MigrationServiceProvider', - 'Illuminate\Database\SeedServiceProvider', 'Illuminate\Foundation\Providers\ComposerServiceProvider', - 'Illuminate\Queue\ConsoleServiceProvider', ]; } diff --git a/src/Illuminate/Queue/QueueServiceProvider.php b/src/Illuminate/Queue/QueueServiceProvider.php index 70f0cacc800c..e623fde28ad8 100755 --- a/src/Illuminate/Queue/QueueServiceProvider.php +++ b/src/Illuminate/Queue/QueueServiceProvider.php @@ -3,13 +3,11 @@ namespace Illuminate\Queue; use Illuminate\Support\ServiceProvider; -use Illuminate\Queue\Console\WorkCommand; -use Illuminate\Queue\Console\ListenCommand; -use Illuminate\Queue\Console\RestartCommand; use Illuminate\Queue\Connectors\SqsConnector; use Illuminate\Queue\Connectors\NullConnector; use Illuminate\Queue\Connectors\SyncConnector; use Illuminate\Queue\Connectors\RedisConnector; +use Illuminate\Contracts\Debug\ExceptionHandler; use Illuminate\Queue\Connectors\DatabaseConnector; use Illuminate\Queue\Failed\NullFailedJobProvider; use Illuminate\Queue\Connectors\BeanstalkdConnector; @@ -70,32 +68,13 @@ protected function registerManager() */ protected function registerWorker() { - $this->registerWorkCommand(); - - $this->registerRestartCommand(); - $this->app->singleton('queue.worker', function ($app) { return new Worker( - $app['queue'], $app['events'], - $app['Illuminate\Contracts\Debug\ExceptionHandler'] + $app['queue'], $app['events'], $app[ExceptionHandler::class] ); }); } - /** - * Register the queue worker console command. - * - * @return void - */ - protected function registerWorkCommand() - { - $this->app->singleton('command.queue.work', function ($app) { - return new WorkCommand($app['queue.worker']); - }); - - $this->commands('command.queue.work'); - } - /** * Register the queue listener. * @@ -103,41 +82,11 @@ protected function registerWorkCommand() */ protected function registerListener() { - $this->registerListenCommand(); - $this->app->singleton('queue.listener', function ($app) { return new Listener($app->basePath()); }); } - /** - * Register the queue listener console command. - * - * @return void - */ - protected function registerListenCommand() - { - $this->app->singleton('command.queue.listen', function ($app) { - return new ListenCommand($app['queue.listener']); - }); - - $this->commands('command.queue.listen'); - } - - /** - * Register the queue restart console command. - * - * @return void - */ - public function registerRestartCommand() - { - $this->app->singleton('command.queue.restart', function () { - return new RestartCommand; - }); - - $this->commands('command.queue.restart'); - } - /** * Register the connectors on the queue manager. * @@ -257,9 +206,8 @@ protected function registerFailedJobServices() public function provides() { return [ - 'queue', 'queue.worker', 'queue.listener', 'queue.failer', - 'command.queue.work', 'command.queue.listen', - 'command.queue.restart', 'queue.connection', + 'queue', 'queue.worker', 'queue.listener', + 'queue.failer', 'queue.connection', ]; } }