Fork me on GitHub

Tuesday, February 3, 2009

Blog / General / News / 2PL? In my FP? It’s more likely than you think!

2PL? In my FP? It’s more likely than you think!

With SVN revision 241 I’ve added a new functionality to FlatPress along with a bunch of fixes to some inconsistencies of the backend.

For the latter, I’ve just removed the old ugly array_change_key_case by setting to lowercase array strings at a lower level; not really awesome news here :D

What’s really cool (in my obviously not-so-humble opinion) it’s a new mechanism I’ve implemented to store your entries.

What was wrong with the old? Nothing much really, apart from the fact that a failure in the index backend would have prevented your entry to be saved.

Artist’s Rendition:


The new system is a little bit more cumbersome, but should be safer.

In short, before the entry is added to the indices it is stored in the draft area (fp-content/content/drafts/); once each index has been updated the draft is then MOVED to the correct place (fp-content/content/YY/MM/).

This might result sometimes in a duplicate draft/published entry when a failure occurs in the middle of the process, but it is not really a defect.

No, it’s not a 2-Phase Locking :D, but it’s still something.

If you know you usually edit a few times your entry before it’s really definitive, as I do, in order to work better, I suggest to always save as DRAFT, and only FINALLY publish.

In rev.241 there are other fancy additions; the error message connected with write failure is now more descriptive in the panel; also you’ll get a nice yellow notice when you’re editing a draft, remembering you the entry is not published.

I’ve also added a few classes to the <body> tag of the panel; in this case .draft will dim your background to a darker shaede of grey to remember you visually the editing is ’safer’.

I hope you’ll like it!