1. Go to this page and download the library: Download bnomei/kirby3-janitor library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bnomei / kirby3-janitor example snippets
use Bnomei\Janitor;
use Kirby\CLI\CLI;
return [
'description' => 'Example',
'args' => [] + Janitor::ARGS, // page, file, user, site, data, model
'command' => static function (CLI $cli): void {
$page = page($cli->arg('page'));
// output for the command line
$cli->success(
$page->title() . ' ' . $cli->arg('data')
);
// output for janitor
janitor()->data($cli->arg('command'), [
'status' => 200,
'message' => $page->title() . ' ' . $cli->arg('data'),
]);
}
];
wget https://dev.bnomei.com/plugin-janitor/e9fe51f94eadabf54/janitor%3Abackupzip --delete-after
// or
curl -s https://dev.bnomei.com/plugin-janitor/e9fe51f94eadabf54/janitor%3Abackupzip > /dev/null
return [
// return `true` for maintenance and `false` to skip maintenance
'bnomei.janitor.maintenance.check' => function(): bool {
// example: block unless it is a logged-in user and it has the admin role
return kirby()->users()->current()?->role()->isAdmin() !== true;
},
// other options...
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.