How to add versioning to a web app?



  • Hi folks!

    I'm writing my own wiki-like app and I'd like to add versioning to it. For example, I'd like to be able to "undo" edits that others commit. What's the proper way of doing this? I'm thinking about keeping the source text and a set of insertion deletion commands (sort of like diff). I'll also save the "final" or "last" version of the page so I don't have to recreate the edits every time I want to serve the page. Any comments/critiques to this process?

     

    Thanks!


     



  • Do you have some specific requirement (huge media files, very limited storage, something like that) that makes storing complete versions and just serving them by version number unreasonable?  That is, after all, the simplest thing that could possibly work given what you've said so far.  Not the cleverest, most efficient storage-wise, or most interesting, but screaming fast for access and much harder to screw up than any delta-based scheme you care to invent.

    What about building the wiki-like parts on top of libsvn and completely abstract out the revision storage?  Possibly overkill, and definitely complex, but the svn guys are going to be better at revision management than you are.

    Have you looked at how mediawiki et al store revisions?  The source is there to read.
     



  • Angstrom,

    Point taken! I thought about storing everything as well but then realized that I might end up storing thousands of megs of mostly identical stuff. I wanted to be a bit more clever than that I guess. I'm using PHP so I don't think I can use libsvn. I'll look into mediawiki.

     
    Thanks!

     



  • Svn is good, so is RCS or any other source control system. The faster, the better.

    I've worked with TWiki (I can only recommend it, have a look at this before you write your own) and their versioning system is based on RCS -- http://www.gnu.org/software/rcs/rcs.html

    You definitely do not need a C library interface, you can use the command line tools to manage the files. RCS is perfect for this because it stores the revision on a per-file basis (SomeArticle.txt is versioned in SomeArticle.txt,v) rather than the berkeleyDB that I think SVN uses. Concurrency is much less of a problem / bottleneck that way.

    You can always keep the current file in the file system so you can access it without any database or other overhead. When you make changes, commit it to the repository to save the changes. When viewing older revisions you can retreive/check out those revisions.

     It's a rather neat and performant way of doing it.
     


Log in to reply