Kirby3 Janitor - a panel button to run jobs defined in php

Cheers @bnomei ! In regards to the other problem I’m having with the DuplicatePage exception… (I’ll keep it on the forum because i’m not sure if it’s a bug yet… I’m having a hard time to get my head around it)

I’ve tracked it down that this piece is causing it:

'command' => function ($command = null) {
    // resolve queries
    $command = \Bnomei\Janitor::query($command, $this->model());
    // append model
    if ($this->model() instanceof \Kirby\Cms\Page) {
        $command .= ' --page ' . $this->model()->uuid()->toString() ?? $this->model()->id();
    } elseif ($this->model() instanceof \Kirby\Cms\File) {
        $command .= ' --file ' . $this->model()->uuid()->toString() ?? $this->model()->id();
    } elseif ($this->model() instanceof \Kirby\Cms\User) {
        $command .= ' --user ' . $this->model()->uuid()->toString() ?? $this->model()->id();
    } elseif ($this->model() instanceof \Kirby\Cms\Site) {
        $command .= ' --site'; // boolean argument
    }
    $command .= ' --model '. $this->model()->uuid()->toString() ??
        ($this->model() instanceof \Kirby\Cms\Site ? 'site://' : $this->model()->id());
    return $command;
},

If I remove the $this->model()->uuid()->toString() references then everything works as excepted. If I keep them I get the DuplicatePage exception as mentioned in my screenshot above.

I wonder if it’s somewhat related to “a-call-to-uuid-causes-a-write-on-a-virtual-page” but I’m really flabbergasted on what’s happening here… Can’t really seem to replicate it in plainkit either.

If you have any ideas … at a loss here :sweat_smile: