We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3642
    • 48 Posts
    I just posted a quick tutorial on using Subversion with MODx. It is available at http://wiki.modxscrolls.com/index.php?title=Subversion - comments and criticism are welcome.

    Mike
      Michael Henderson
      MODxCMS + Dreamhost P/S + BBEdit
      Safari + Mac OS X 10.8
      • 27708 MODX Staff
      • 2,502 Posts
      Great tutorial! Thanks for that. I have been playing with MODx and SVN but the big question for me is the DB--what do you with the DB contents. These like much else in MODx are DB dependent from templates to snippets. Any thoughts?

      Cheers,

      Jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 3642
        • 48 Posts
        I’m too new to all of this to have much of a clue smiley Assuming that we’re talking about the DB items like variables and chunks, I can see dumping tables to flat files and letting subversion do the deltas. I think that would be simple for chunks since they’re just text and not really related to anything else. I don’t understand enough about the other items, like TVs, to know if it’s possible to get a consistent snapshot of them.

        Mike
          Michael Henderson
          MODxCMS + Dreamhost P/S + BBEdit
          Safari + Mac OS X 10.8
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          In my dev environment at work, it’s unusual to put database entries through the versioning control... usually the reason they’re in the database in the first place is so they can change quickly.

          But I see the issue here. Wordpress has a folder where these additional plug-ins/snippets get installed, whereas MODx puts this stuff in the database.

          Perhaps the easy solution here is to just upload the new versions of the snippets and name them with a version number, where the most recent one uses the "real" snippet name. E.g.

          [[ My Snippet ]] would be renamed to [[ My Snippet v1 ]]
          and [[ My Snippet v2 ]] could be renamed to [[ My Snippet ]]
          That way every page that used the [[ My Snippet ]] code would now pull its results from the new bit of code.

          This solution is a bit low-brow... I suppose ideally, you’d add a column to the database that defined the version of the snippet and you’d be able to choose which one is active.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Why couldn’t you use a simple include line in the snippet, and have your actual code in a file that is managed by svn?
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 3642
              • 48 Posts
              @sottwell, can you point me to an example of what you are talking about? i’m not sure if this is about the cache or the content or plugin/snippets.
                Michael Henderson
                MODxCMS + Dreamhost P/S + BBEdit
                Safari + Mac OS X 10.8
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                It’s about the actual snippets. Instead of having a lot of php code in the snippet in the Manager, just have one include ’filename’ line. Specify the path to the .php file. You can actually do this with all of the snippets, put the code in a .php file and include it in the snippet in the Manager. This way you will have a much smaller cache file, as well as the ability to work with the .php files as files.

                You can even put your template HTML into a file, and in the template field in the Manager have just a snippet; the snippet code would include the file.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 3642
                  • 48 Posts
                  my goal is to learn one new thing every day - modx certainly makes that easy grin
                    Michael Henderson
                    MODxCMS + Dreamhost P/S + BBEdit
                    Safari + Mac OS X 10.8