bnomei / kirby3-janitor

Kirby Plugin for running commands like cleaning the cache from within the Panel, PHP code, CLI or a cronjob

Home Page:https://forum.getkirby.com/t/kirby3-janitor-plugin/23573

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

syntax error, unexpected token ")"

theamnesic opened this issue · comments

Hi,

With Kirby 3.5.7, php 8.0.8, Janitor 2.16.2, I've got the syntax error, unexpected token ")" error alert on this tasks :

  • cleanCache
  • flushSessions
  • render
  • thumbs
  • backupZip

flushPages works.

Switching to php 7.4 give this error : syntax error, unexpected '|', expecting variable (T_VARIABLE).

Console error : GET https://mysite.com/api/plugin-janitor/cleanCache/%24 500 (Internal Server Error)

https://mysite.com/api/plugin-janitor/cleanCache/ return {"status":"error","message":"Unauthenticated","code":403,"key":"error.permission","details":[]}

Any idea?


Edit : I'm using composer to update. When I download the files via Github instead of composer update, it's working.

commented

Hi,
same problem with Kirby 3.6.6.1 and PHP 8.0.23-he.0

i need a bit more information to debug this since i can not replicate it myself.

  1. how are you calling the janitor job? panel button or CLI?
  2. is it the browser js console you are referring to? how did the GET request get triggered? via the panel button, right?
  3. if the errors are thrown, could you turn on kirbs debugging so i can get a filename and preferable line number?
  4. whats your dev setup like? osx with mamp etc...

you can not call the endpoint manually (without the setup for a secret... see wiki) thats why the auth error is thrown in that case.

Hi Bruno!

how are you calling the janitor job? panel button or CLI?

By the panel button.

Capture d’écran 2022-10-12 à 19 00 21

is it the browser js console you are referring to? how did the GET request get triggered? via the panel button, right?

Yes, the browser console, via the panel button.

if the errors are thrown, could you turn on kirbs debugging so i can get a filename and preferable line number?

Hope this can help:

Capture d’écran 2022-10-12 à 18 56 05

whats your dev setup like? osx with mamp etc...

Same behavior in my local Mamp and my web hosting.

Hi,

Updated to Kirby 3.8.2 and Janitor 3.2.0 installed via .zip file, error is now Class "Kirby\CLI\CLI" not found.

janitor 3 needs kirby cli which can inly be installed with composer

I've just installed with composer with composer require getkirby/cli bnomei/kirby3-janitor.

Now the error is : Undefined constant "STDOUT" in all the tasks, even the flushPages.

Same error with composer require getkirby/cli installed and Janitor 3.2.0 installed via .zip file.

the core commands from the cli are aimed to print to the console.

unless you run these commands with the --quiet parameter, which was recently introduced, it tries to write to the console when there is none (calling from the panel).

i created janior:flush --name pages to allow same functionallity in the panel.

see
https://github.com/bnomei/kirby3-janitor/blob/master/commands/flush.php

i had brought that issue to the teams attention, the fix is easy enough, but sadly it did not make it in the most recent update.

feel free to upvote my issue there:
getkirby/cli#21

Hi @bnomei!

Any news on this since CLI 1.1.0 add the New global --quiet option to suppress the output of the command?