Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Posts
    900
    Plugin Contributions
    0

    Default I would like to change Backup mySQL

    Hi!

    DrByte's Backup Mysql has to be one of the best, most necessary add-ons for any serious ZC. It has saved my tush many times!

    But there is something missing that I have wanted for years: a simple gui for naming the files created.

    Over the years of using it, I have grown accustomed to making a backup, then renaming the file via FTP. This is what it typically looks like:
    01_addBackupMySQL.sql.gz
    02_addTemplate.sql.gz
    03_addImageHandler.sql.gz
    04_addZenLightBox.sql.gz
    …and so on.

    But I am now building sites for clients, most of whom cannot easily accomplish this simple task. I instruct my clients to make backups before they do ANYTHING to the site. This results in gianormous lists of confusing backups to work with.

    Adding an interface for naming the files as you make it would be ideal. But maybe building a gui is just too much work? A very simple fix would be to:
    • Get rid of the DB name/user that is inserted at the beginning (unnecessary info)
    • Make the date/time more user friendly

    To make the date/time more friendly, it might be cool if the file name was something like this (red denotes what is same for every file created):
    Date-YYYY-MM-DD__Time-HH-MM-SS.sql.gz

    So a file I made today (Feb 8, 2013 at 1:15pm) would look like this:
    Date-2013-02-08__Time-13-15-32.sql.gz

    A series of files might look like this (usually matching the date in the center column):
    Date-2013-01-28__Time-08-11-24.sql.gz
    Date-2013-02-07__Time-15-55-03.sql.gz
    Date-2013-02-08__Time-13-15-32.sql.gz

    All of the code to scoop up and name a file is already in place. All that would need doing is reordering and adding the constants.

    Can I get an 'Amen!' brothers and sisters? Anybody want to help do this?

    Or at least point me to where the naming code lives so I can figure out?

    Thanks,
    Mike

  2. #2
    Join Date
    Apr 2010
    Posts
    900
    Plugin Contributions
    0

    Default Re: I would like to change Backup mySQL

    BTW, another pet peeve I have is that the Admin Activity Archives are using the same folder. And because of how they are named, they show up at the top of the Backup mySQL list! Grrrr! 99.9% of users will never need/use these files. Why do they have to clutter up a list that WILL get lots of use?

    I wish Admin Activity Archives used a different folder or were renamed to start with a 'z' so that they get sorted to the bottom of the list! Something as simple as this:
    z_admin_activity_archive_2012-09-28_12-57-15.csv

    But I won't touch that code because I understand the gravity of logging the activity… :)

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,839
    Plugin Contributions
    31

    Default Re: I would like to change Backup mySQL

    Backup Mysql has to be one of the best, most necessary add-ons for any serious ZC
    Absolutely...should be core (IMHO).

    I agree with being able to name the files..I do the same. I've never had the time to do implement the functionality...and maybe I don't want to downgrade the code with my fudges!
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  4. #4
    Join Date
    Apr 2010
    Posts
    900
    Plugin Contributions
    0

    Default Re: I would like to change Backup mySQL

    Quote Originally Posted by torvista View Post
    Absolutely...should be core (IMHO).

    I agree with being able to name the files..I do the same. I've never had the time to do implement the functionality...and maybe I don't want to downgrade the code with my fudges!
    Even if you can't name the files, at least cleaning up the current naming structure would go a long way to making life easier. I guess I don't mind terribly having to name files myself via ftp, I'm more concerned about the mess my clients will make.

    I'm snooping thru code right now but have to leave in a minute, should be a very simple fix with minimal risk to damaging code.

    Adding an interface, on the other hand, would require some effort. I'd be afraid to try it for the same reason.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: I would like to change Backup mySQL

    I'm not sure I understand what the "issue" is. The files are already named with a prescribed naming convention. Is THAT what you don't like?
    Or is it simply that the activity-log backups are also in that folder, and causing you some confusion?

    Or is this an issue of your own making because you're constantly needing to restore from backup because you're doing dev work and breaking things frequently? .... and such problem will be rare in the normal course of operating a live site.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,839
    Plugin Contributions
    31

    Default Re: I would like to change Backup mySQL

    For my part there is no issue....I use automated backups and the naming doesn't matter.
    However I back up manually before doing any db changes or imports and it would be nice to be able to name it on the page at the time rather than remotely.
    Not really important for me, hence I have not bothered to change it....but seems important to help the monkeys the OP works for.

    I restore from backup loads of times...repeatedly on my dev site, for example while trying to get mod sql scripts to work 100% in the SQL patch page.
    I also move the db around between laptops depending where I have to work, and to have a current db to dry-run large imports on.

    Its an essential mod for me, I wouldn't leave home without it.
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  7. #7
    Join Date
    Apr 2010
    Posts
    900
    Plugin Contributions
    0

    Default Re: I would like to change Backup mySQL

    Ditto to everything Torvista said, precisely as said.

    What got me motivated was that a client added a Newsletter page the other day, something that gets coded by a wysiwyg editor on a ConstantContact type CRM site. Whatever they did caused the site to disappear and they freaked out. When I came to sort it out, apparently they had backed up a few times as they were adding other stuff, w/o noticing they had already killed the site.

    So it took me a minute to sort it out. If there was a naming gui, would have been much easier.

    DrByte, your mod is awesome and I love it. I realize the thought of making even minor changes is sacrilege, I really don't mean to offend!

    Renaming the files (w/o adding a gui) is for the lest tech savvy (clients). When my client restored on their own, they restored the wrong files, thought they had lost a number of pages. I think they could have figured out the right file had they paid attention to the center column instead of looking at file names.

    I have helped them to understand it better, don't think these guys will have a problem again. But they are not my only clients.

    Adding a gui would be a convenience for all, but really not necessary for developer (though it would be nice). That would be best solution for monkeys, though. And it would be a convenience for me, as well

  8. #8
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: I would like to change Backup mySQL

    Ha! I'm not worried about sacrilege! But I'm flattered by the thought. Lol.

    While I'm not opposed to the idea of a naming GUI, I am also mindful that the uninformed will similarly misname things and not have a clue which file to pick when they do a restore anyway. I'm not convinced it will completely eliminate the stated problem.

    Adding a dialog to ask for a filename is doable ... just remember you'll need to sanitize inputs to be sure that no unacceptable characters are passed on to the actual backup process, else you'll get errors that there isn't currently any error-handling code for.

    Renaming after-the-fact could be added easily with an ajax script. Still needs validation of acceptable characters. But happening after-the-fact could mean the file gets lost amidst a long list, and thus might be skipped by the newb.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: I would like to change Backup mySQL

    Instead of changing the naming convention... how about allowing the end user to embed a "comment"? This could be embeded in the SQL file... This way both archived and current backups would include the "comment". Although parsing them all to display in admin would be a little extra work...

    Not something I personally need, but just another way to save "Why did the last backup occur?"
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  10. #10
    Join Date
    Apr 2010
    Posts
    900
    Plugin Contributions
    0

    Default Re: I would like to change Backup mySQL

    DrByte,

    I really hope you do get some satisfaction from the fact that we all look up to you as much as we do. For every one person you help directly by replying to questions in this forum, a dozen or more will stumble in and find the solutions you give. Everyone knows that solutions you give can pretty much be taken as the Word of God!

    And the mods you have provided are spectacular. It must be neat to know that right at this very moment somewhere in Asia or S Dakota or the UK, there are people using things you created!

    Backup MySQL, in particular, was a real stroke of genius!

    That's why I'm embarrassed to even suggest that an improvement could be made. But I can't help it, I just think the way the files are named are bit messy.

    This is what I did. I found the code for naming files in admin/backup_mysql.php (this line):
    Code:
    $backup_file = 'db_' . DB_DATABASE . '-' . ($tables_to_export != '' ? 'limited-' : '' ) . date('YmdHis') . '.sql';
    And then I restructured it a bit:
    Code:
    $backup_file = '00-Date_' . date('Y') . '-' . date('m') . '-' . date('d') . '__Time-' . date('H') . '-' . date('i') . '-' . date('s')  . '.sql';
    The resulting file names (see attached image):
    • have the db info removed
    • clearly state the date and time
    • match (within a few seconds) the date/time given in center column
    • appear above the Admin Activity Archives

    DrByte, if you see any error in my restructuring, please let me know.

    While I would greatly prefer a naming GUI, I don't trust my abilities enough to do it myself. If anybody wants to do it, I will be happy to beta!

    Name:  Screen Shot 2013-02-11 at 10.41.52 AM.jpg
Views: 131
Size:  52.4 KB

 

 

Similar Threads

  1. Would like to change the title of emails I send
    By lizar5- in forum Managing Customers and Orders
    Replies: 2
    Last Post: 18 Dec 2007, 02:52 AM
  2. Would like to change center part...
    By Kruna in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 11 May 2007, 10:24 PM
  3. Would you like to LOG YOURSELF IN?? -- Change?
    By dctarbuck in forum General Questions
    Replies: 2
    Last Post: 17 Feb 2007, 05:50 AM
  4. would like to change banner (logo.gif)
    By zc-newbie in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 13 Aug 2006, 01:40 PM

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