We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22815
    • 1,097 Posts
    This is an auto-generated support/comment thread for Modbak.

    Use this forum to post any comments about this addition or any questions you have regarding its use.

    Brief Description:
    Module to backup an entire MODx site (files AND database) into a .zip.
      No, I don't know what OpenGeek's saying half the time either.
      MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
      Forum: Where to post threads about add-ons | Forum Rules
      Like MODx? donate (and/or share your resources)
      Like me? See my Amazon wishlist
      MODx "Most Promising CMS" - so appropriate!
      • 20765
      • 90 Posts
      myfriendscallmebill Reply #2, 17 years, 9 months ago
      Hello--

      Over the weekend I tried using ModBak to migrate a site from one server (running MySQL 4.1.21-standard) to another (running MySQL 4.0.27-standard).

      Restoring the database failed with an error that said something about an incompatible SQL statement). So instead of using modbak’s database backup, I exported from phpMyAdmin on the first system, with "MySQL 4.0 compatibility" selected, then imported using phpMyAdmin on the second system.

      So I’m wondering if modback should allow us to choose the version of MySQL we want the backup to be compatbile with...?
        • 17802
        • 190 Posts
        Hello,
        I’m trying to use Modbak with a site that’s running in safe mode... it seems that isn’t possible. When I push the ’Generate backup’ button I get the following error message:
        Error : PCLZIP_ERR_READ_OPEN_FAIL (-2) : Unable to open archive '/opt/guide/www.mysite.nl/HTML/_modbak/tmpbackup.zip' in wb mode
        Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit in safe mode in /opt/guide/www.mysite.nl/HTML/manager/processors/execute_module.processor.php(95) : eval()'d code on line 139

        Is there a known workaround for this? Thanks.
          Thanks for MODx - I love it!
          • 11429
          • 90 Posts
          I’d like to make a suggestion, is there a way to have modbak use the name of the site and/or database name for the sql file ? that way you could see backups for different modx installations

          afterall, the /_backup/ directory is outside the root so it would make sense that we would direct backups for all modx installs to that folder

          ie site1_backup.sql site2_backup.sql site3_backup.sql

            • 28471
            • 48 Posts
            Quote from: gspark at Feb 12, 2007, 05:50 PM

            I’d like to make a suggestion, is there a way to have modbak use the name of the site and/or database name for the sql file ? that way you could see backups for different modx installations

            afterall, the /_backup/ directory is outside the root so it would make sense that we would direct backups for all modx installs to that folder

            ie site1_backup.sql site2_backup.sql site3_backup.sql

            Not sure if this is too late, however the newer version (092) uses the sitename for archive and database file, also memory and time limits are set as variables, aswell as using the modx table_prefix, so it should help with a few issues.
              • 14050
              • 788 Posts
              Now this is bizarre. I am trying to install this module; however, when I cut and paste in this code from the modbak.module.tpl file:

              /**
              *  Description: 
              *  Backup modx files and compress into .zip for easy download
              *  @author Robin Stemp <[email protected]>
              *  @version 0.9.4 Fixed issues with . in site name
              *  @version 0.9  4 Mar-07 Added table_prefix - restructured some code
              *  @version 0.8 13-Feb-06  Added log tables, excluding log data. 
              *                          Added check for .htaccess file, backup directory.
              *                          Added MODx Manager theme header (header.inc.php)
              *                          More testing done.  
              *  @version 0.5 11-Feb-2006, not heavily tested though
              * 
              *  Setup:
              *     1. change $modx_backup_dir to directory for zip archives and make sure read/write permission is set for directory
              *     2. change $modx_backup_dir in /assets/modules/modbak/download.php file, note download.php requires full path name
              *         ie /home/username/public_html/_backup/
              * 
              *  ----------------------------------------
              *  Uses PCLZIP Library for zip compression
              *  Courtesy of http://www.phpconcept.net 
              *  ----------------------------------------
              */
              
              /**
              *   Variables to set:
              *       modx_backup_dir [string]
              *                Path to create archives and sql file in, must be writable
              * 
              *       archive_prefix  [string]
              *                Prefix for archive filename
              * 
              *       archive_suffix  [string]
              *                Suffix for archive filename
              * 
              *       database_filename [string]
              *                Filename for SQL dump file
              *
              *       table_prefix [string]
              *               Table prefix to dump tables, default is current modx $GLOBALS['table_prefix']
              * 
              */
              
              // directory to contain zipped archives, default is servers document root, not secure
              $modx_backup_dir = $_SERVER['DOCUMENT_ROOT'].'/_backup/';
              
              
              /*
              *  $modx_root_dir 
              *        MODx Base path
              *  $mods_path
              *        Modules Path
              */
              $modx_root_dir =$modx->config['base_path'];
              $mods_path = $modx->config['base_path'] . "assets/modules/";
              $site_name = str_replace(' ','_', $modx->config['site_name']);
              
              // Archive file name prefix - 5mar07 - change to default site name
              $archive_prefix = (isset($archive_prefix))? $archive_prefix: $site_name;
              
              // Suffix to add to archive name  (ie modxbackup12-11-2005-1735)   .zip will be added to output file
              $archive_suffix = date('d-m-Y-Hi');
              
              // sql database filename
              // 5mar07 - change from database_backup.sql to sitename.sql - robstemp
              $database_filename = $site_name.'.sql';
              
              // Table Prefix
              $table_prefix = (isset($table_prefix))? $table_prefix: $GLOBALS['table_prefix'];
              
              // include Log table data in database backup, these tables can be quite large, so default is to exclude them
              $dump_log_tables = false;
              
              $out =  '';
              
              // temporary file for archive, this is created and then renamed if zip is successfull
              $tempfile = $modx_backup_dir.'tmpbackup.zip';
              
              // memory / time settings
              $zip_time_limit = 250;
              $zip_memory_limit = '12M';
              $db_time_limit = 250;
              $db_memory_limit = '12M';
              
               
              // ------------------------------------------------------ MAIN CODE ----------------
              include_once $mods_path.'modbak/modbak.php';
              include_once $mods_path.'modbak/display.php';
              return $out;


              And then click on "Save" it loads the frontend of the website in the same frame, and doesn’t save the code. It actually does this if I paste it into a snippet, plugin, chunk, or module. However, if I manually type something in these boxes it is fine, or if I paste in other text it is fine. What is it about this text that causes the problem? I am using 0.9.6 RC-2 from SVN. I have also attached a screen shot.

                Jesse R.
                Consider trying something new and extraordinary.
                Illinois Wine

                Have you considered donating to MODx lately?
                Donate now. Every contribution helps.
              • Sounds like something is triggering the dreaded "mod_security" setup of your Apache server.
                  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
                  • 14050
                  • 788 Posts
                  Any tips or tricks to help avoid triggering this? Isn’t it something I can talk with my host about?
                    Jesse R.
                    Consider trying something new and extraordinary.
                    Illinois Wine

                    Have you considered donating to MODx lately?
                    Donate now. Every contribution helps.
                    • 14050
                    • 788 Posts
                    Alright...I added this line to my .htaccess in my manager folder. Will some please advise if this is a major security risk?

                    SecFilterEngine On
                    SecFilterSelective "REQUEST_URI" "index.php" "allow,nolog"
                      Jesse R.
                      Consider trying something new and extraordinary.
                      Illinois Wine

                      Have you considered donating to MODx lately?
                      Donate now. Every contribution helps.
                      • 4310
                      • 2,310 Posts
                      Just tried modbak 0.94 on a 0.9.6 RC2 install.
                      When I run the module I get this screen in the manager.
                      If I click generate it goes to a white panel in the manager and doesn’t create the backup.
                      _backup folder is set to 777.
                      Apache server.
                      Any ideas?
                      P.S. Found this in the event log for the time I hit generate...
                      "Undefined index: nrtotalmessages" seems to be line 42 in header.inc.php but I’ve no idea what it does!
                      It has also created a backup named tmpbackup.zipin the _backup folder.