We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26401
    • 247 Posts
    I'm trying to set up a one-click environment transfer development -> production and production -> development that are located on the same server under different subdomains. They use different databases, have a different root folder, and a different web address.

    Right now I'm going through a somewhat lengthy process of backing up an entire folder, then expanding it in the other folder using cPanel. Then overwriting the config files to have the correct database and file/folder info. Then, using cPanel I generate a database copy and using heidiSQL I replace the database (except the managerlog table)

    I'm thinking of setting up a php script on a separate domain that transfers the database and files, but it's a bit of a tedious process, and wanted to see before I invest too much time into this if anyone's dealt with this already.
      • 3749
      • 24,544 Posts
      I don't have a good solution to offer, but it will save you some time and trouble if you exclude the config files from the .zip file on the development machine.

      core/config/config.inc.php
      config.core.php
      connectors/config.core.php
      manager/config.core.php

      (There's one in the setup directory as well, but I'm assuming you're not transferring that.)
        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
        • 13428 ☆ A M B ☆
        • 1,031 Posts
        If you could access the Apache sites-enabled files, this would be only a swap of the sites-enabled configuration files for the two installations. Simple said: the webroot for both installations is swapped. No edit of config files needed (the paths/databases are the same). You just have to clear the cache of both MODX installations.

        I have not tried that with MODX installations, but with other systems.
          • 26401
          • 247 Posts
          and .htaccess if you're using this part of it

          # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
          # https://www.domain.com when your cert only allows https://secure.domain.com
          #RewriteCond %{SERVER_PORT} !^443
          #RewriteRule (.*) https://example-domain-please-change.com/$1 [R=301,L]
            • 13428 ☆ A M B ☆
            • 1,031 Posts
            @scorche: Yes, I have missed the .htaccess entries. Using more universal regex strings in that could avoid swapping/changing those files.
              • 22840
              • 1,572 Posts
              MarkH is developing a extra for using GitHub to manage this sort of thing, https://github.com/modmore/Gitify
                • 26401
                • 247 Posts
                I ended up running a couple of functions to do this.

                One backs up the entire db (except the manager_logs) to a file
                Next one reads the file into the desired database
                Finally I copy the files over skipping the config, htaccess, and any cache files

                I also have it updating the page as I go along to see the process any any errors. Takes usually under two minutes.