Update several thousand page attributes
Permalink
I have several thousand pages at the moment (a few over 3000), and each page has a scored assigned to it (number attribute)
I need to update this score every day.
At the moment, I've created a job that will get a pagelist of all these pages, and then loop through them all updating the score attribute.
Is there any faster way of doing this? Only it takes several minutes, and can sometimes memory out.
I need to update this score every day.
At the moment, I've created a job that will get a pagelist of all these pages, and then loop through them all updating the score attribute.
Is there any faster way of doing this? Only it takes several minutes, and can sometimes memory out.
Hi John,
Thanks for the reply, for some reason ths blog didn't email me telling me someone had replied,
I ended up just doing it via sql rather than using pagelists, as it was just too data/memory/resource intensive trying to do it through standard concrete5 models.
Thanks for the reply, for some reason ths blog didn't email me telling me someone had replied,
I ended up just doing it via sql rather than using pagelists, as it was just too data/memory/resource intensive trying to do it through standard concrete5 models.
You could build the update into the pages, either writing a small block to do it or using Magic Data + Black Magic Data. So each time a page was loaded it checked and updated its own attribute. If you don't like the overhead when the page loads, you could defer it into an ajax callback using blocks by ajax.
You could use an on_before_render or on_render_complete event handler to do similar.