I’ve recently taken over a website built by another dev team. It has a library of documents (Static Resources) and separately a news page.
The articles on the news page are imported into the website from a third-party API using a snippet that runs on a cronjob.
Something seems to be causing some of (not all) the static resources to jump into this news page parent.
I’ve installed VersionX to gain a better insight into the history of these resources, but until it happens to a resource created after this install I don’t have the data.
I understand without the scripts it is challenging to diagnose. I was enquiring mainly if anyone had any advice on how I should go about diagnosing the problem.
There is some lines in the script that refresh the URI’s. Which to me feels like it could be related.
I think the only solution that may be available is to rewrite the import scripts for the news articles.
Step to reproduce
I can’t provide these in this case.
Observed behavior
As mentioned above, some of the static resource’s parent is being changed.
The only way that could happen is if something is changing the parent field in the modx_site_content table. Maybe the cronjob snippet is calling set('parent', $someValue); with a wrong value, or not setting the parent field, but using fromArray() to set the fields using an array that holds an old value for the parent field.
Another thing to consider is that resources at the root of the tree have 0 in their parent field. Maybe the code is using some default if the parent field is empty.
A bit of a long shot, but might the CRON job be interacting with the ImportX snippet? This does have an option to set a default parent on import. https://docs.modx.com/current/en/extras/importx