Buildup of records in a block table that are no longer needed.
Permalink
I have posted here to address this issue once before in a discussion labeled "Deleting a block does not remove record from db table." It was pointed out that they are not deleted because of their availability for previous versions of the pages that contain the block. I accepted this answer then but now I have a new concern for this.
I 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.
I 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 add-on tool looks good. I think I will try it out before the final deployment of a site that I have been working on. This looks good for a personal use tool but my concern is to be able to do clean-up as records are no longer needed because an instance of my block type is removed. I believe that a house should be kept clean rather than attempt to clean up the mess after the house has been completely trashed.
I just found in automated jobs in the dashboard, "Remove Old Page Versions". I ran it and it deleted zero versions from 3 pages, the home page, the about us page and the blog page and none of the other 6 pages that I have created and worked on leaving many previous versions. So, that one is a useless tool.
To clean your whole site, you have to keep clicking the 'Run' button until the system reports that "All pages have been processed, starting from beginning on next run."
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.
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.
How interesting. I went back and it took 4 presses of the run button to muddle through all the pages. My test page was the last page it operated on and didn't clear any old versions out. This page is sitting on version 11. I wouldn't have known that I have to keep pressing it unless someone told me to. Thanks. If this tool actually worked, I would just leave it at that as the device to clean up the unwanted.
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?
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?
The core job just does a few p[ages each run, and leaves the 10 most recent versions. Extreme Clean is more dangerously daring and scrubs the lot.
Actually, I take this back. I am remembering throughout my earlier researches of running across some block methods available to get a list of all the block instances of a block types that currently exist. The most reasonable method would be hook into removing the object from a page that I could then add code to remove the accompanying record. However, adding a 2nd table to remember the instances just might work, assuming that I am right that a method is available to get a list of active instances.
Thanks.
Thanks.
Not really. I am looking for a programming solution to add to my plug-in. But with all things considered, I am beginning to think that this is better left alone and let the dashboard tools deal with it.
I was referring you to this block because somewhere in that code will be a function that finds all the blocks. That's how we all learn this stuff.
Once more.
I am still pondering whether or not to just leave this alone.
I am still pondering whether or not to just leave this alone.
You know how I feel. There are only so many hours in a day. You can't solve every problem so be as effective as you can with your time. Choose your battles wisely.
Adrian
Arvixe Web Hosting / Concrete5 Community Liaison |
http://www.arvixe.com/concrete5_hosting.............