Being the thoughts and writings of one Gustaf Erikson; father, homeowner, technologist.

This category is about this weblog

Monday, 2006-02-27


Entriescache and meta tags — preventing index file corruption

I had some problems with corrupted entries in the indexfile for entriescache recently. Yesterday it happened again, which pissed me off no end. So I’ve been researching ways to prevent this.

My first thoughts were to use a real version control system, like CVS or Subversion. I could then use the revision tags to keep track of creation and update times. But this wasn’t an option for me, as neither CVS nor SVN exist on my host, and I don’t feel like compiling them statically.

So I had a look at the entriescache plugin itself. There’s an option to write a meta-creation_date when the post is indexed. This is then “authoritative” in case the timestamp in the index file is changed.

The problem was that I had edited my some of my posts a lot of times since starting to use entriescache. So I wrote a script that updated (or rather, backdated) the timestamps according to the data in the index file (which had been restored from backups). After this, I changed the option that controls whether the plugin will write a meta tag, and reindexed.

Voila! I now have a meta tag in each and every post that can be used to keep track of the posts creation time if all else fails. And since it’s added by the plugin, I don’t have to add it manually in the editor.

Addendum

I made a slight change to the plugin too: the default timestamp format is in the middle-endian US way (MM/DD/YYYY). I modified it to write and read ISO 8601 dates instead.

Submit a comment

Please enter comments as plain text only; HTML is not supported. Submitting an URL is optional.

Comments are moderated and may not appear immediately.

Comments are closed for this story.