Closed bvdputte closed 2 years ago
the $
is my own idea to give the site object an id because $site->id() does not exist. just a way for me to use site but keep working with a route pattern that expects an id.
i will take a look why the issue you described is appearing asap.
i can not replicate this error on my local setup. even when using the same function names that you have.
i assume you are useing the most current version of janitor. which kirby version?
using vardump in before the response will always fails since the resulting json is not valid anymore. but guess you just added that to make your issue clearer.
if debugging try using a logger or append to repsonse using 'myval' => print_r($var, true),
.
'replenishMyCache' => function (Kirby\Cms\Page $page = null, string $data = null) {
return [
'status' => 200,
'label' => 'External stuff fetched',
'data' => print_r($data, true),
];
},
@bvdputte not really sure why its not working on your setup. have you tried again since?
Hi @bnomei , sorry for the late reply.
I just checked again with your demo code in my site (Kirby 3.5.7.1 - janitor 2.11.0) to no avail. This is wat is returned:
{"status":"error","message":"No route found for path: \"plugin-janitor\/test\/$\" and request method: \"GET\"","code":404,"exception":"Exception","key":null,"file":"\/kirby\/src\/Http\/Router.php","line":154,"details":[],"route":null}
@bnomei ; I found the culprit. It interferes with my .htaccess
configuration to omit trailing slashes:
# Omit trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R]
When I remove this, janitor works as advertised. Any way to workaround this and keep my htaccess config working?
nice find. i will see if thus can be solved with another route.
I have the same issue. It was driving me crazy what is going on. It works on default nginx config but on clients hosting with apache and default provided .htaccess
i get
No route found for path: "plugin-janitor/backupZip/$" and request method: "GET"
How can i solve this? @bvdputte what have you done?
@iskrisis I postponed the feature 🙈
But what really bugs me is that it works in nginx fine so what can i do to Apache to behave the same? You mention trailing slash @bvdputte but it seems to me that the url from nginx is same as in Apache. 🤷 It's wierd because i think i used button in site.yml just fine on apache in the past.
@bvdputte @iskrisis in current release there is a route that should match the path. https://github.com/bnomei/kirby3-janitor/blob/5c8a33cc391af41c9af4ef4bc21b7f11e4fd692c/index.php#L171
does it not work?
I must say i didn't find why it wasn't working. It was clients shared hosting Apache so probably some unusual defaults and i am not even experienced with Apache to debug it.
I've moved the janitor button from site.yml to page and it works no problem.
@bvdputte @iskrisis in current release there is a route that should match the path.
does it not work?
First, sorry for the late feedback. Second, I have just checked this again, and I can now confirm it works 👍
Thanks for this really nice plugin @bnomei ❤️
Is it expected that my custom janitor job button doesn't work from
site.yml
blueprint without adding adata
(which I don't need) property to it?This is my
site.yml
:and this is the job defined in my
config.php
:When I remove
data: blablabla
from the blueprint, the button doesn't work and I get a 404 in the panel for the call:http://mywebsite.test/api/plugin-janitor/replenishMyCache/$
-> I notice a$
is appended? Is this expected? FYI: whendata: blablabla
is in the blueprint, the url that is fetched looks like this:http://mywebsite.test/api/plugin-janitor/replenishMyCache/%24/mlkqsjdf
Am I doing something wrong?
When I test this on a page blueprint, I don't need to add the
data
property. It just works as expected then?