Results 1 to 10 of 327

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Posts
    334
    Plugin Contributions
    0

    Default Re: Backup MySQL Database

    I installed BACKUP_MYSQL Admin Tool Designed for: Zen Cart v1.3.x and 1.5.x series on my 1.5.5. Zen Cart.

    Everything appears is working fine.

    But I have 2 questions:

    1. Admin->Tool menu shows sub menu "DataBase BACKUP_MYSQL" 2 times:

    Attachment 17055

    2. When I use both options No Compression (Pure SQL) and Use GZIP generating backup is compressed in both cases.

    Is this issue of installation of web hosting server software?

    Any suggestions are appreciated.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Backup MySQL Database

    Quote Originally Posted by idtags View Post
    I installed BACKUP_MYSQL Admin Tool Designed for: Zen Cart v1.3.x and 1.5.x series on my 1.5.5. Zen Cart.

    Everything appears is working fine.

    But I have 2 questions:

    1. Admin->Tool menu shows sub menu "DataBase BACKUP_MYSQL" 2 times:

    Attachment 17055

    2. When I use both options No Compression (Pure SQL) and Use GZIP generating backup is compressed in both cases.

    Is this issue of installation of web hosting server software?

    Any suggestions are appreciated.
    I've finally gotten around to again needing to get this to work on a particular host because I have some specific database testing to perform and after a good bit of review and minor modification I came across the above issue (which actually was the problem to begin with).

    So here's thing and I'll address the above first:
    Starting on line 209 of admin/backup_mysql.php:
    Code:
              switch ($_POST['compress'] && file_exists(DIR_FS_BACKUP . $backup_file)) {
                case 'gzip':
                  @exec(LOCAL_EXE_GZIP . ' ' . DIR_FS_BACKUP . $backup_file);
                  if (file_exists(DIR_FS_BACKUP . $backup_file)) @exec('gzip ' . DIR_FS_BACKUP . $backup_file);
                  break;
                case 'zip':
                  @exec(LOCAL_EXE_ZIP . ' -j ' . DIR_FS_BACKUP . $backup_file . '.zip ' . DIR_FS_BACKUP . $backup_file);
                  if (file_exists(DIR_FS_BACKUP . $backup_file) && file_exists(DIR_FS_BACKUP . $backup_file . 'zip')) unlink(DIR_FS_BACKUP . $backup_file);
              }
    The test to the right of the word switch: $_POST['compress'] && file_exists(DIR_FS_BACKUP . $backup_file) Well... by checking the radio button for "NOT" compressing (or to compress) well that results in the post to contain some text (even if it is the word no) and then that is && with the existence of the file which should basically be true at least when submitted through the admin screen interface. Well, the post of text that is not false && with a true condition evaluates to true. Then case 'gzip' is evaluated against a statement of true and since gzip isn't false or NULL it evaluates as true and the code within the case 'gzip' area is executed. During that execution (which is how I found the solution to my problems) the gzip function is attempted any number of ways. First by use of the software as identified in LOCAL_EXE_GZIP (defined in admin/includes/init_includes/init_gzip.php) and then basically if that doesn't work directly by use of gzip. What this also means though is that the 'zip' code never gets executed...

    So I made the following changes in this area:
    Code:
              switch ($_POST['compress'] . (file_exists(DIR_FS_BACKUP . $backup_file) ? 'true' : '')) {
                case 'notrue':
                  break;
                case 'gziptrue':
                  @exec(LOCAL_EXE_GZIP . ' ' . DIR_FS_BACKUP . $backup_file);
                  if (file_exists(DIR_FS_BACKUP . $backup_file)) @exec('gzip ' . DIR_FS_BACKUP . $backup_file);
                  break;
                case 'ziptrue':
                  @exec(LOCAL_EXE_ZIP . ' -j ' . DIR_FS_BACKUP . $backup_file . '.zip ' . DIR_FS_BACKUP . $backup_file);
                  if (file_exists(DIR_FS_BACKUP . $backup_file) && file_exists(DIR_FS_BACKUP . $backup_file . 'zip')) unlink(DIR_FS_BACKUP . $backup_file);
              }
    But... There's something about it all... There is just enough functionality in here to support a compressed backup, which could unfortunately also not be decompressed if several things do not line up correctly. I later found that I had to either modify the setting for LOCAL_EXE_GUNZIP to just be gunzip instead of some file path or modify the command for unzipping so that it referenced gunzip directly rather than with LOCAL_EXE_GUNZIP... Problem being that the decompressed file would get generated but have no content in it and because it exists that there was an attempt to restore the "nothing" which "succeeded" though made no changes.

    Anyways, had the above "mistake" not existed, then I wouldn't have known that the system supported gzip (install seemed to indicate that it didn't exist, but when running the backup of this site, a file was successfully gziped even when the request was to not do so... Ie. a whole mess of confusion, but finally sorted out... Now though, if nothing else is done to attempt to override the compression, every backup would be non-compressed and still would not know that the system supported compression... Little bit of a round robin, no? Obviously a little additional checking here or there might make it easier/faster to resolve, but...

    The above may or may not help someone, I don't really suggest making the changes in the base code without first incorporating some sort of additional testing/checking that gzip isn't an available option. I can safely make the above change(s) the the plugin's file, identify to the plugin to override compression, and modify the path to the compression/decompression programs and now have the option to export compressed or not, and can restore either a compressed or non-compressed file.
    Total changes:
    Above code changes.
    in: admin/includes/extra_datafiles/backup_mysql.php
    changed:
    Code:
    define('COMPRESS_OVERRIDE',false);
    //define('COMPRESS_OVERRIDE',true);
    to:
    Code:
    //define('COMPRESS_OVERRIDE',false);
    define('COMPRESS_OVERRIDE',true);
    in admin/includes/init_includes/init_gzip.php
    changed:
    Code:
      define('LOCAL_EXE_GZIP', '/usr/bin/gzip');
      define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');
      define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');
      define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');
    to:
    Code:
      define('LOCAL_EXE_GZIP', 'gzip');
      define('LOCAL_EXE_GUNZIP', 'gunzip');
      define('LOCAL_EXE_ZIP', 'zip');
      define('LOCAL_EXE_UNZIP', 'unzip');
    though the changes made above won't really make the zip option available for selection. That requires some other modifications for that option to be displayed.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,732
    Plugin Contributions
    27

    Default Re: Backup MySQL Database

    Quote Originally Posted by idtags View Post

    2. When I use both options No Compression (Pure SQL) and Use GZIP generating backup is compressed in both cases.

    Is this issue of installation of web hosting server software?

    Any suggestions are appreciated.
    The radio button does not work correctly when saving to the server, it only uses the defaulted radio button - gzip regardless of the selection.

    Select 'Download without...' and the radio buttons work.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian

 

 

Similar Threads

  1. Backup MySQL Database vs using cPanel backup option?
    By IronMan101 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 30 Jul 2007, 08:46 AM
  2. Database Backup Manager - MySQL
    By sicness in forum All Other Contributions/Addons
    Replies: 7
    Last Post: 7 Aug 2006, 09:42 PM
  3. Backup MySQL Database failure
    By JFD in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 3 Jun 2006, 06:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg