We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1924
    • 119 Posts
    Hi,

    good work.

    But it won´t work if the file-structure is too big. My site has ca. 35 Mb and modbak allways generate only a tmpbackup.zip.
    Is there any possibility to put it on the run again?

    Peace, Alex
      • 28471
      • 48 Posts
      Quote from: apollo009 at Feb 23, 2007, 08:29 AM

      Hi,

      good work.

      But it won´t work if the file-structure is too big. My site has ca. 35 Mb and modbak allways generate only a tmpbackup.zip.
      Is there any possibility to put it on the run again?

      Peace, Alex

      This is probably due to a memory or timeout issue php performing the compression, one option would be to try and edit the php.ini, assuming you have access to the host.

      max_execution_time = 30 ; Maximum execution time of each script, in seconds
      max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
      memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)

      If not, another option would be for the module to shell out to zip, and dump the db, (using the native OS zipping functionality, or 3rd party, and mysql’s dumping), I’m looking into this, however you would still require shell access for your hosting.

        • 4643
        • 34 Posts
        Hi,
        Great module, it has helped me a lot. I’m administering a large number of sites and I use this to "copy" an old site and create a skeleton for a new one - I simply edit the SQL stuff before creating the next site.

        Anyway - I’ve noticed a peculiarity. Maybe it is by design, or maybe you didn’t think about it.

        Modbak backs up one site - but the entire database. In my case I have one database for all sites so every backup contains one large SQL file containing every website in the hosting account.

        Reason for having it in one database: Godaddy puts a restriction on a hosting account, max 25 databases. By using one database and simply prefixing the tables "site_no_1_" etc, I don’t have to worry about having only 25 sites in a hosting account - the only limit is then bandwidth and since I have low bandwidth sites, there is virtually no limit at all.

        If I had a dedicated server, I would probably use one database per site instead to limit the risk of making mistakes when editing the database directly.

        But since MODx offers the possibility of a prefix at install - surely, it is sort of intended that a database can contain many sites and other stuff.

        Is there any (simple) way I can make Modbak backup only the tables belonging to the site I’m backing up? I had a look at the code, but there was nothing very obvious to me.
          • 28471
          • 48 Posts
          Quote from: carlotto at Mar 04, 2007, 07:27 PM

          Hi,
          Anyway - I’ve noticed a peculiarity. Maybe it is by design, or maybe you didn’t think about it.

          Modbak backs up one site - but the entire database. In my case I have one database for all sites so every backup contains one large SQL file containing every website in the hosting account.
          Is there any (simple) way I can make Modbak backup only the tables belonging to the site I’m backing up? I had a look at the code, but there was nothing very obvious to me.


          Yeah, I didnt think of it at the time.

          Just uploaded an updated version which has table_prefix variable, the default value is taken from modx so this should be the current modx site. Could you try it out on your sites and see how it goes.

          Thanks.
            • 4643
            • 34 Posts
            [Edited this quite a lot on Tuesday March 6, 1:25 AM]

            Hi, thanks. Quick reaction there.

            OK, it works - it now only backs up one set of tables, i.e. one site. Thanks you ver much!

            Somehow the backups no longer get ".zip" added and I suspect that is why I can’t see them in Modx, have to use an FTP client to see them and download them.

            My backup file now gets a name like this:
            site-name-here_db.org-2007-03-06-0128

            There is no sign of it under "Current Backups" in modbak inside MODx. But using WS-FTP to my directory (I have a /secretplace/ under the hosting root for backups), I can download, rename to zip and use it.

            Even after renaming the file with a .zip ending, it is still not visible in the MODx Modbak interface. I suppose that is by design somehow, but I don’t understand why this is.

            If I untick "Add database tables", everything works as expected, visible in the web interface, can download etc.


            Another slight problem (but something I can live with):
            You use the server document root as a base, but in my case (Godaddy), I have a heap of sites under the same document root. This means that backups for all sites end up in the /hosting-root/secretplace/ but it might have been more logical if they were in
            /hosting-root/site-number62/secretplace
            etc.

            Godaddy has a strange way of arranging my sites:

            The physical path is of the start of the hosting account is something like /m/y/n/myname/html/

            so the main site (the one used to create the hosting account) has its files here. All other sites added later are located under this in a directory structure. Example: "anothersite.com" may be here on the server:

            /m/y/n/myname/html/secretpath/anothersite/

            So this can be reached in two ways, which is not very nice:

            1) www.anothersite.com/index.php
            or
            2) www.firstite.com/secretpath/anothersite/index.php

            I have one Modx in each site directory, so if 50 Modx sites, I have 50 x Modbak’s etc. It would of course have been much more sensible to keep only one copy of MODx (the unchanging parts) on top, use directory alias for these to all sub-sites and keep only the changing parts of MODx under each site. Unfortunately, it’s a bit of a mess in MODx what is a "constant bit" and a "changing bit" and also, I don’t think I can do this with .htaccess files which is the only weapon I have at Godaddy.


            [Edited this quite a lot on Tuesday March 6, 1:25 AM]
              • 4643
              • 34 Posts
              Forgot to mention....

              There is a ’filemanager_path’ in the system_settings table for a site. This path points exactly to the physical directory where the url base is for each site, so different even if many sites under one server document root.

              So - instead of using $_SERVER[’DOCUMENT_ROOT’] which could point outside of the scope of a website, it might be an idea to use the ’filemanager_path’ from the Modx settings. That would allow for having many sites under one server document root (as is the case with Godaddy) and keeping backups in different folders for each site.

              Not sure if that is what I want, as it is actually quite convenient to have all backups in one folder only (now when they are properly named after each site), then removing them off the hosting account. Just thought, I’d mention it.

                • 4643
                • 34 Posts
                Hi again Forum,
                I’ve found a (temporary?) solution, posting it here in case anyone else have a problem with Modbak.

                Summary:

                If you have the site name in any form in either the prefix or suffix, there are problems.

                Problem 1: Modbak somehow fails to add .zip to the file. It’s still a zip file, you just need to change name.

                Problem 2: If you have anything except a string of fixed characters as prefix, there is a risk that your backups will not be visible in the web interface. I haven’t figured out exactly what’s going on here. Apparently the interface will only show files starting with (or containing - not sure) the prefix you state in the .tpl file. But it’s not as simple as that, it seems that when you have a variable (like the site name), it sometimes show you the file, sometimes not.


                To make it work, I changed this line in modbak.tpl :
                $archive_prefix = (isset($archive_prefix))? $archive_prefix: $site_name;

                to
                $archive_prefix = ’backup_’;

                I use this suffix:
                $archive_suffix = date(’Y-m-d-Hi’);
                and that works.

                It does NOT work as soon as I add anything with the $site_name in either the prefix or suffix, either at front or back. So these things, or anything similar doesn’t seem to work:
                $archive_suffix = $site_name.’_’.date(’Y-m-d-Hi’);
                $archive_prefix = ’backup_’.$site_name;

                It seems to be a problem with previous versions as well, I tried using a prefix like:
                $archive_prefix = $modx->config[’site_name’];
                in an older Modbak. It produces the name ok, but zip ending is lost.
                adding a constant string in front of the site_name such as ’backup_’ doesn’t help.

                OK, that will give you some clues if you need to tweak things and I hope, save you a lot of trial and error time.

                I hope these little problems can be sorted out, Modbak is a brilliant module, a very handy thing to have. It should really be in the standard MODx package (assuming it isn’t, haven’t checked lately). If it could be combined with a one-click restore as well, it would be a real killer.

                Here are some keywords for people Googling:
                Modbak zip gone lost filename prefix suffix
                  • 28471
                  • 48 Posts
                  Quote from: carlotto at Mar 07, 2007, 05:10 PM

                  Hi again Forum,
                  I’ve found a (temporary?) solution, posting it here in case anyone else have a problem with Modbak.

                  Summary:

                  If you have the site name in any form in either the prefix or suffix, there are problems.

                  Problem 1: Modbak somehow fails to add .zip to the file. It’s still a zip file, you just need to change name.

                  Problem 2: If you have anything except a string of fixed characters as prefix, there is a risk that your backups will not be visible in the web interface. I haven’t figured out exactly what’s going on here. Apparently the interface will only show files starting with (or containing - not sure) the prefix you state in the .tpl file. But it’s not as simple as that, it seems that when you have a variable (like the site name), it sometimes show you the file, sometimes not.

                  Hi Carlotto, [Problem 1] : I think it is to do with any . characters in the sitename (as it was splitting filename using .), I have just updated it and will upload it later on today so it should fix this issue.

                  [Problem 2] Possibly related to 1, will have another look into it.

                    • 4643
                    • 34 Posts
                    Thanks,
                    Of course it’s the dot - obvious now you mention it. I have a dot in all my sitenames.

                    I’ll give it another go with your updated versions later and stress it a bit. Will post result here later. Thanks again for good work, this is a really good module.
                      • 28471
                      • 48 Posts
                      Quote from: carlotto at Mar 15, 2007, 02:22 PM

                      Thanks,
                      Of course it’s the dot - obvious now you mention it. I have a dot in all my sitenames.

                      I’ll give it another go with your updated versions later and stress it a bit. Will post result here later. Thanks again for good work, this is a really good module.

                      Sorry I thought I uploaded new version, but forgot, just uploaded version 0.9.4. which fixes the . in sitename, and added a settings.php file