bvdputte / kirby-queue

A simple queue utility plugin for Kirby 3
MIT License
32 stars 3 forks source link

Reliable way of linking to kirby folder & kirby bootstrap file #2

Open bvdputte opened 5 years ago

bvdputte commented 5 years ago

In worker.php, bootstrap.php and the path to the Kirby folder are based on the default locations and cannot be altered.

This will give problems to people who have a non-default folder setup, or use composer.

Find a way to make this better.

adamkiss commented 5 years ago

One solution, at least for the cron usage, would be setting the cron with an argument, like /var/whatever/worker.php /../path/to/root/, and then using the (optional) argument when requiring bootstrap.php, like this:

$kirbyPath = __DIR__ . (count($argv) > 1 ? $argv[1] : '/../../../../');
require "{$kirbyPath}kirby/bootstrap.php";