Skip to content

Commit 47310d4

Browse files
authored
πŸ§‘β€πŸ’» Add support for routes/console.php (#465)
* 🎨 Clean up the Console boot process
1 parent 8b1dc37 commit 47310d4

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

β€Žsrc/Roots/Acorn/Application/Concerns/Bootable.phpβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ protected function bootWpCli(): void
7777
$kernel->bootstrap();
7878

7979
WP_CLI::add_command('acorn', function ($args, $options) use ($kernel) {
80-
$kernel->commands();
81-
8280
$escaped = array_map(fn ($arg) => escapeshellarg($arg), $args);
8381

8482
$command = implode(' ', $escaped);

β€Žsrc/Roots/Acorn/Console/Kernel.phpβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ public function __construct(Application $app, Dispatcher $events)
8686

8787
$this->app = $app;
8888
$this->events = $events;
89-
90-
$this->app->booted(function () {
91-
$this->resolveConsoleSchedule();
92-
});
9389
}
9490

9591
/**
@@ -100,5 +96,9 @@ public function __construct(Application $app, Dispatcher $events)
10096
public function commands()
10197
{
10298
$this->load($this->app->path('Console/Commands'));
99+
100+
if (file_exists($routes = base_path('routes/console.php'))) {
101+
require $routes;
102+
}
103103
}
104104
}

0 commit comments

Comments
Β (0)