So I have encountered a strange behavior with subpages and can’t seem to find a fix for it. The problem only occurs on the live server so the error could come from the server and not kirby.
The problem
When an image is deleted from a subpage and you don’t save after and directly delete the page, the page folder isn’t deleted only its content, so you can’t create a new page with the same title and the deleted page dosen’t show up in the panel.
I thought it could be that rewritebase was incorrectly set as the site lives in public_html but changing rewritebase to RewriteBase /public_html only crashed the site.
Could you please be more specific? I’m assuming you mean removed from a files field, not deleted from the page? Because otherwise there would be nothing to save…
On the template were the problem occurs the user can choose from a radio field if they want to submit one image or a video url. Which conditionally shows a files field or url field. So the issue happens when a user have selected image, uploaded one, and then removing it from the field and then without saving directly deletes the page.
Sorry my server knowledge is somewhat slim. The hosting service we use doesn’t give that much info about cache, and no way to turn it off if it is on, so my guess there isn’t one.
Although when checking the phpinfo() there is a CACHE_ROOT in Apache Environment, does this mean there is caching from the server?
So I’ve just enabled the error log and recreated the problem but nothing showed up in the folder i choose for the log. To be sure that I set the path to the log correctly, I checked it with phpInfo and the path shows up under local value for error_log.
I can’t really tell what might be causing this, Kirby uses pretty low level file/directory operations when removing a file and I have no idea what could prevent deleting this folder unless it was no longer accessible by the webserver.
Which version of Kirby and PHP are you using? Where are you hosting?
You can always raise an issue on GitHub, only if it is not reproducibly in other contexts, might be hard to solve unless someone has an idea.
What about custom code? Are you using any 3rd party plugins/own plugins?
Maybe just tell the user to save before deleting in the meantime, after all, this is probably nothing that will happen often?
Or if you have a chance to test this on another server, might be worth it as well.
I understand, its a hard one to figure out when it isn’t easily reproduced.
Kirby 3.9.1 and php 8.2. Used kirby 3.8 and php 8.0 prior but updated today to see if it would solve the issue. The site is hosted on Loopia. Tried to exclude the plugins but the problem persisted.
Yeah the problem is kinda niche, so always saving have to be the solution for now.