Skip to content

Commit

Permalink
Make worker improvements more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdputte committed Oct 28, 2021
1 parent a9e55da commit 27fb440
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
/*
* For servers without cron, enable "poormanscron"
* ⚠️ Ugly, non-performant hack to bypass cache
* @TODO: Fix this as soon as this is possible:
* https://github.com/getkirby/ideas/issues/23
*/
if (option("bvdputte.kirbyAutopublish.poormanscron")) {
bvdputte\kirbyAutopublish\Autopublish::poorManCronRun();
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ It is built to work with enabled cache.
Add the worker file `site/plugins/kirby-autopublish/worker.php` to [cron](https://en.wikipedia.org/wiki/Cron) or similar at the desired interval (.e.g. each minute).

💡 This is the preferred method for setting up kirby-autopublish.
⚠️ There is a [demo worker file](https://github.com/bvdputte/kirby-autopublish/blob/master/worker.php) included in the plugin that should work with the Kirby default folder setup. In case you use a [custom folder setup](https://getkirby.com/docs/guide/configuration#custom-folder-setup), please copy the worker an adjust the paths to match your installation.

#### 2. Poor man's cron

Expand Down
8 changes: 5 additions & 3 deletions worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
use bvdputte\kirbyAutopublish\Autopublish;

// Bootstrap Kirby (from with the plugin's folder)
require '../../../kirby/bootstrap.php';
$kirbyPath = dirname(__FILE__) . "/../../../../";
$projectRoot = dirname(__DIR__) . '/../../';
require $projectRoot . 'kirby/bootstrap.php';

// Instantiate Kirby
$kirby = new Kirby([
'options' => [
'debug' => true,
],
'roots' => [
'kirby' => $kirbyPath
'kirby' => $projectRoot . 'kirby',
// 'content' => $projectRoot. 'content',
// 'site' => $projectRoot. 'site',
],
]);

Expand Down

0 comments on commit 27fb440

Please sign in to comment.