Buildup of records in a block table that are no longer needed.
PermalinkI have just finished a package that is a block that can be added several times on many pages. The instances of this block type may be removed and replaced many times in the course of the life of a c5 web site. You have to publish the updated web page before it can be the version that is displayed to the public. Since c5 will not allow you to delete published versions of pages, the result will conceivably build up a mass of unneeded records in the block table. This is very bad housekeeping.
Does anyone have a remedy for this or expound on my concern for this very poor housekeeping issue.
This Job handles only 3 pages at once so that you don't overload your server. I've changed the values in my PHP to do 10 pages at a time and remove all but the last 3 pages of each.
I understand your desire to keep the database clean but I wouldn't worry about it. Unless you have a site where the clients are making tons of changes to tons of pages, a stable site rarely runs out of database room. The only time I see the size of the tables grow is while I'm building out the site because I'm saving often but once I hand the site to my client, the rate of growth drops significantly. Turning off traffic statistics is the easiest way to cut down on the size of the database and how fast it grows.
Perhaps you can build something into your 'save' function that cleans out unneeded records in the Blocks table but determining which blocks are no longer needed is probably a trick in itself.
As far as cleanup of the old upon save of a new instance, I don't think there is any way to know programmatically, what other instances are still active and which were deleted.
Is there an Event that I could hook into that fires on deleting the instance of a block type from a page?
Thanks.
I am still pondering whether or not to just leave this alone.
Adrian
Arvixe Web Hosting / Concrete5 Community Liaison |
http://www.arvixe.com/concrete5_hosting.............