Currently, the renaming feature for files (images, etc) feels broken. When renaming an image, the references to that image are not updated, resulting in broken content. What’s the use of being able to rename a file if its references aren’t updated? This feels more like a bug to be fixed than a feature request.
I can confirm that. Same behaviour on Page Renaming and User Renaming.
I think this should be addressed ASAP, its quite confusing for panel users understand that if they change a file also need to update other parts of the panel. And if they dont, sometimes this can break the whole site.
I am afraid this is quite impossible feature with flat file architecture. There is no relational database so there are no references. It happens around kirby and you have to keep eye on that. It’s just tradeoff given simplicity of the system.
Kirby using the file-system as a DB does not mean this is impossible.
One approach that comes to mind: An array of reference IDs could be stored in each file’s metadata file (IDs to each document that uses the file). Then, when renaming a file, it’d be a simple matter of parsing the content of the dependency files and updating the filename(s) therein.
It is entirely possible to recreate database on filesystem using PHP… but at some point you start to recreate what traditional databases offer.
Like with page references, it would probably make more sense to store an ID (attached to an image via the file metadata) for the image rather than keep changing the references. This is already possible via the AutoID-Plugin: https://github.com/bnomei/kirby3-autoid/, which will hopefully make it to the core one day.
Have gone the way with autoid but i get the weird “Invalid argument supplied for foreach()”. And since it is not only applicable to Files but Pages and Users too a quick Fix should be done… Is there any updates on this. Anyone else has these errors?
It does feel like a ‘bug’ - hopefully it will get fixed soon!
We need the equivalent of a database’s “cascade on update”.
I think it is extremely unlikely that Kirby will ever offer a feature that walks through all content files etc, trying to updated stored values.
Considering that, I was contemplating whether this idea should be considered implemented once https://kirby.nolt.io/16 / https://github.com/getkirby/kirby/pull/4612 has landed in the 3.8.0 release. Since it offers unique IDs also for files, which stay the same no matter of renaming a file, using these unique IDs (as well as their connected permalinks) would in my view solve the idea brought forward here.