Open tgeorgel opened 3 months ago
up
I also had a similar setup and noticed it would boot the Acorn Kernel AND my custom Kernel.
Maybe you can try to overwrite the implementation for \Roots\Acorn\Console\Kernel
instead:
\Roots\bootloader()->boot(function ($app) {
$app->singleton(
\Roots\Acorn\Console\Kernel::class,
\App\Console\Kernel::class
);
});
// see comment below
// }, 0);
Also the Acorn boot priority was updated recently: https://github.com/roots/radicle/commit/5af169578560f6b1b7ec0879b4d4ce2d7842f25c
This is also something you could try.
Recently I got rid of overwriting the Kernel and moved my logic to a ServiceProvider instead. But I don't know if that's also possible for scheduling.
Version
v4.2.2
What did you expect to happen?
I'm using Acorn in combinaison with Radicle.
I did register a Kernel instance :
Which provides schedules :
Schedules are working nicely, but the load of Wordpress is not complete.
For example, If I would want to get the permalink of a page inside my command :
When using WP-CLI, this works perfectly :
But in the scheduler context, I get :
What actually happens?
When running the scheduler with acorn, the acorn binary is called.
This binary loads wordpress and then expect acorn to boot on top :
The seconds line nevers gets called.
What actually happens is that the
wp-settings.php
file is going to load the mu-plugins, which loads Acorn (00-acorn-boot.php
), and the load of Acorn "captures" the "request", and so any code that should have run after the load of mu-plugins (insidewp-settings.php
) won't run, including settings up default post_types and so on :This means that if I run a command with the scheduler :
The
debug:dump
command won't be able to get a permalink (eg:get_permalink(1)
) as the internalget_post_status_object()
function could not return values because the core is not fully loaded.Steps to reproduce
Create a Kernel class :
Make sure to register the kernel class when booting acorn :
Then, after creating a command which tries to display a permalink, test it thru the scheduler using
wp acorn schedule:test
.System info
MacBook Air M1 MacOS Sonoma 14.5 PHP 8.2.18
Log output
No response
Please confirm this isn't a support request.
Yes