I would like to delete only one specific page (the home for example) using your janitor:flush built it command, but I don’t get what should I pass to the --name parameter to do so.
I tried the following command, but it doesn’t work:
janitor()->command('janitor:flush --name home --quiet');
I’m not sure it makes any difference, but I’m using staticache plugin and it’s a multilingual K3 website, so the cache files I’m trying to delete are:
neither kirby core not janitor support flushing a single page within the core pages cache. the name parameter should be set on the id of a cache like “pages” or “my.plugin”.
but you could create a custom command that removes the files you need given a page id. and then call that from janitor.
on second thought… since the core pages cache (even if its powered by staticache plugin like in your case) adheres to the cache class interface your command could do something like this (untested).
REMOVED
and iterate over each language. i might find the time early next week to add that to janitor. I will report back then.
edited: removed the untested code example as it did not work as intended.
v4.4.0 adds the trash command which you can use in the CLI and as a panel button to remove entries of any cache by key. by default it will remove the pages cache for the current page.
janitor_trash:
type: janitor
command: 'janitor:trash'
label: Removes Pages Cache for this page
icon: trash
The pages cache creates a key for each language. Something like home.en.html. it will be the same key with or without the staticache plugin. But using the --page argument will be easier.
web hook PHP
janitor()->command('janitor:trash --page home');
since Janitor v4.3 the --quiet will automatically be appended if running commands in PHP and not the CLI
CLI kirby janitor:trash --page home
some more examples on how to use the arguments directly in the command itself
The examples you added as comments in the command itself are very useful!
I even think you should add them directly to the plugin README, at least for those with arguments, to make them more accessible.