We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23703
    • 180 Posts
    There are quite a few scripts that helps with installing and updating MODX. None of them did all that I needed so I wrote my own using some of the existing ones as inspiration, mainly Everett Griffiths and Dmytro Lukianenkos (dmi3yy).

    • It handles moved and renamed core folder.
    • It handles renamed manager, connectors and assets folders.
    • Backups can include and exclude files or directories of your choice as well as exclude tables in the database (ex manager_log).
    • Backups can be saved to a remote server via FTP.
    • Restores can be downloaded from a remote server via FTP.
    • Updates can be run automatically (cli mode via shell_exec).
    • It downloads the distribution file of your choice from modx.com.
    • The script uses curl for all uploads and downloads.
    • Optional deletion of installation before update. You can specify files and folders to exclude from deletion. (Not sure if this is really needed, but it is handy if you want to be sure there are no old files left after an update.)
    • The backup and restore functionality and the (optional) ability to rewrite config files gives you the ability to move a site around, ex from local dev server to live site and vice versa.

    https://github.com/Pont/modx-zip
      • 3749
      • 24,544 Posts
      That sounds fantastic. smiley

      Something like this has been needed for a long time.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 3749
        • 24,544 Posts
        So far, I love it! I had to set the password in one place in the code, and adjust the backup directory in two places. Then I backed up and updated a localhost site in about 2 minutes with a few clicks.

        One tiny suggestion. Have the backup directory (backup_path) default to:

        'backup_path' => '#base_path/backup',


        instead of the web root. This would allow those of us with many MODX installs in separate subdirectories to back up to a directory within a site. Otherwise, all the backups will be in the same directory with no way to tell which is which except the time.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 10795
          • 38 Posts
          @Pont- thanks, much appreciated! I'll be testing this out over the next month. Will come in handy.
            • 23703
            • 180 Posts
            I'm glad you like it! smiley

            @Bob: I don't really think backups (and other files stored in the backup directory) should be accessible so I set the default above the web root (provided that the site is in the web root).
              • 3749
              • 24,544 Posts
              Quote from: Pont at Aug 31, 2014, 02:19 PM

              @Bob: I don't really think backups (and other files stored in the backup directory) should be accessible so I set the default above the web root (provided that the site is in the web root).

              Good point. The trouble is that if you have multiple sites in subdirectories, a) the backup files end up in the web root, and b) the backup files for the different sites all end up in the same place.

              One thing that might help would be to get the site_name System Setting, clean it up, and add it to the name of the backup file.

              Another idea would be to store them under MODX_CORE_PATH, since people concerned about security will put that above the web root.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 23703
                • 180 Posts
                I'll look into adding specific information to the file name to make it more unique per site. site_name is a good candidate since it will be the same both on development and live server.

                However, be aware that using the same file on several sites interferes with the functionality to backup/restore between different servers since the configuration is per site. The script isn't really intended to work with multiple sites. If you don't use that functionality there is no problem, but if you do, and want the configuration files to be updated automatically, you can't use the same file for different sites since the database credentials (the xmldata options) will differ.
                  • 23703
                  • 180 Posts
                  The site name is now added to the backup file name to make it more unique. This is handy if you collect backup files from several installations in one directory. If the installed site's name corresponds to the name of the backup file you will only see the timestamp in the list of backup files. If the site name has been changed you will see every backup file in the backup directory with the site names included (if any).
                    • 3749
                    • 24,544 Posts
                    Sounds good. smiley
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 36573
                      • 173 Posts
                      This looks great. I've uploaded to my root directory now how do I run it?
                        Everything I know I learned on the internet. Saved me thousands in College tuition,