We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37550 ☆ A M B ☆
    • 711 Posts
    It would be great if in a future release there was an option to auto create backups of snippets, chunks etc i/e keep last X revisions, I’ve recently been writing a snippet in my favorite PHP editor which i then copy and paste into MODx and hit save.

    A few days a go i accidentally opened the wrong snippet up and pasted my snippet into it and hit save, which caused me to loose the original snippet and a few hours work which I did earlier that day.

    So this got me thinking it would be good if there was a revision history as I’m sure i’m not the only one who edits stuff by mistake.

    :D
      http://www.onesmarthost.co.uk
      UK MODX Hosting with love.
      • 22303 MODX Staff
      • 10,725 Posts
      The revisioning system being designed and planned for 1.0 release will include the source of all "content elements" managed in the database. That includes snippets, chunks, plugins, modules, TV’s and the main content.

      Also, just as an aside, I currently avoid this by always keeping my snippets in external files. In other words, the only source code in my snippets is something like:
      return include ($modx->config['base_path'] . 'assets/snippets/mysnippet/mysnippet.snippet.php');

      I then keep the snippet files in SVN...

      This has the added benefit of significantly reducing the size of my siteCache file, since it reduces the amount of source code stored inside of it.
        • 37550 ☆ A M B ☆
        • 711 Posts
        Thats a wicked idea, then i could just upload the changed snippets, whats SVN?

        Thanks for the tip. grin

        Aaron.
          http://www.onesmarthost.co.uk
          UK MODX Hosting with love.
          • 33372
          • 1,611 Posts
          Another safety-oriented workaround is to click Duplicate before you edit your snippet. Then you have a backup copy of it before your changes and you can revert to it if anything goes horribly wrong. I started doing this after one particularly stressful day when I also overwrote the wrong snippet (and I hadn’t made a backup in a while either - d’oh!).
            "Things are not what they appear to be; nor are they otherwise." - Buddha

            "Well, gee, Buddha - that wasn't very helpful..." - ZAP

            Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: awardle at May 17, 2007, 10:25 AM

            Thats a wicked idea, then i could just upload the changed snippets, whats SVN?

            Thanks for the tip. grin

            Aaron.

            SVN = Subversion, a revision control system, similar to CVS (or MS SourceSafe); it’s what we use to manage development of MODx as well.
              • 37550 ☆ A M B ☆
              • 711 Posts
              Quote from: ZAP at May 17, 2007, 10:51 AM

              Another safety-oriented workaround is to click Duplicate before you edit your snippet. Then you have a backup copy of it before your changes and you can revert to it if anything goes horribly wrong. I started doing this after one particularly stressful day when I also overwrote the wrong snippet (and I hadn’t made a backup in a while either - d’oh!).

              Yep I did think about this, I have to admit though it was 7am in the morning when I made the mistake and I was still suffering from sleepy eyes, I think for sites I’m developing I will switch the servers MYSQL backup service to hourly just in case, and alongside this I will start to put core snippets as includes.

              Thanks for the tips all.

              :)
                http://www.onesmarthost.co.uk
                UK MODX Hosting with love.