Jan Zonjee Posted February 24, 2008 Share Posted February 24, 2008 This contribution aims to get the database backup manager in osC 2.2 to work better with large databases especially on servers where safe_mode is set to on. Quote Link to comment Share on other sites More sharing options...
xavkick Posted February 25, 2008 Share Posted February 25, 2008 This contribution aims to get the database backup manager in osC 2.2 to work better with large databases especially on servers where safe_mode is set to on. Hi, I have try your contribution, but i still have problem to backup my database. When i launch you contrib, after 30 second, i have the backup but when i look in the backup i do not have all the table. xav Quote Link to comment Share on other sites More sharing options...
jumpwire Posted February 29, 2008 Share Posted February 29, 2008 This contribution aims to get the database backup manager in osC 2.2 to work better with large databases especially on servers where safe_mode is set to on. uploaded the files and i get this error: Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag in /"myroot"/catalog/admin/backup.php on line 1112 any ideas?? thanks john Quote Link to comment Share on other sites More sharing options...
invasi0n Posted March 9, 2008 Share Posted March 9, 2008 Hi, I downloaded the contribution and i think everything works perfect. There's just one thing that I don't understand... You said that we have to let the script to do its job, and do not click on anything, but screenshot_restore_1.gif shows a Submit button. What is its use? Thanks. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted March 9, 2008 Author Share Posted March 9, 2008 There's just one thing that I don't understand... You said that we have to let the script to do its job, and do not click on anything, but screenshot_restore_1.gif shows a Submit button. What is its use? The script relies on a tiny bit of JavaScript to submit itself. In the unlikely event you can work in the admin with JavaScript turned off the script wouldn't work so therefore the Submit button (that I have to hide again if the submit is in progress otherwise you start two backup processes...). You can also hit the submit button if you can't wait the 4 seconds :) Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted March 9, 2008 Author Share Posted March 9, 2008 Hi, I have try your contribution, but i still have problem to backup my database.When i launch you contrib, after 30 second, i have the backup but when i look in the backup i do not have all the table. Sorry guys, didn't notice your posts until today. Regarding your problem, this contribution was supposed to avoid that. Perhaps safe mode is off but still you cannot increase the time a script can run with tep_set_time_limit. Try "forcing" the script to avoid running any longer than 30 seconds please by commenting line 24 and uncommenting line 25 in admin/backup.php: // $safe_mode_setting = (@ini_get('safe_mode') == 'On' || (@ini_get('safe_mode') === 1)) ? true : false; $safe_mode_setting = true; // for testing After 25 seconds or a little over it you should be presented with the intermediate screen like shown in screenshot_reload_backup.gif. Quote Link to comment Share on other sites More sharing options...
invasi0n Posted March 9, 2008 Share Posted March 9, 2008 The script relies on a tiny bit of JavaScript to submit itself. In the unlikely event you can work in the admin with JavaScript turned off the script wouldn't work so therefore the Submit button (that I have to hide again if the submit is in progress otherwise you start two backup processes...). You can also hit the submit button if you can't wait the 4 seconds :) I understand now. Thanks. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted March 9, 2008 Author Share Posted March 9, 2008 (edited) uploaded the files and i get this error: Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag in /"myroot"/catalog/admin/backup.php on line 1112 any ideas?? Perhaps you don't have any backups yet? That's a scenario I didn't think of (and didn't test). Oops. It does happen when there are no backups. If I add another two lines to check for that I don't get the warning anymore (admin/backup.php). Adding a line on line 1084 and the end for it about 35 lines further: if (sizeof($contents) > 0) { // if no backups are there yet // you would get an error Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag in backup.php on line 1112 foreach ($contents as $key => $filedata) { $contents_size[$key] = $filedata['size']; $contents_file[$key] = $filedata['file']; $contents_date[$key] = $filedata['date']; } // sort files as requested, by name, file name, date ascending or descending switch ($listing) { case "name-asc": array_multisort($contents_file, SORT_ASC, $contents); break; case "name-desc": array_multisort($contents_file, SORT_DESC, $contents); break; case "date-asc": array_multisort($contents_date, SORT_ASC, $contents); break; case "date-desc": array_multisort($contents_date, SORT_DESC, $contents); break; case "size-asc": array_multisort($contents_size, SORT_ASC, $contents); break; case "size-desc": array_multisort($contents_size, SORT_DESC, $contents); break; default: // the old behaviour: new files last array_multisort($contents_date, SORT_ASC, $contents); break; } } // end if (sizeof($contents) > 0) Edited March 9, 2008 by Jan Zonjee Quote Link to comment Share on other sites More sharing options...
xavkick Posted March 9, 2008 Share Posted March 9, 2008 Sorry guys, didn't notice your posts until today. Regarding your problem, this contribution was supposed to avoid that. Perhaps safe mode is off but still you cannot increase the time a script can run with tep_set_time_limit. Try "forcing" the script to avoid running any longer than 30 seconds please by commenting line 24 and uncommenting line 25 in admin/backup.php: // $safe_mode_setting = (@ini_get('safe_mode') == 'On' || (@ini_get('safe_mode') === 1)) ? true : false; $safe_mode_setting = true; // for testing After 25 seconds or a little over it you should be presented with the intermediate screen like shown in screenshot_reload_backup.gif. THANK YOU for your help, but i have still the same problem; i have switch the line 24 an 25 but but still have a blanck screen after 20 second. But when i go back i have few tables but not all. What should i do ? Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted March 9, 2008 Author Share Posted March 9, 2008 THANK YOU for your help, but i have still the same problem; i have switch the line 24 an 25 but but still have a blanck screen after 20 second.But when i go back i have few tables but not all. What should i do ? A blank screen? You should be getting the HML that starts around line 291: if ($resume_dump == true && $safe_mode_setting == true) { // in safe mode: no set_time_limit available fclose($fp); // now show HTML that will resume backup ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> (etcetera, etcetera to around line 416) Nothing there if you do a view source of that page? It looks like there is an error of some kind (is there an error log?) but for the life of me I wouldn't know what that could be. I tested this a thousand times (OK, I exagurate a bit but still a lot of times) without problem. Quote Link to comment Share on other sites More sharing options...
Freeman Posted March 9, 2008 Share Posted March 9, 2008 Hi Jan, i tried to backup the dband it went fine, but when trying to restore it this is the error msg i had : " Error: File pointer for getting file offset cannot be read." And it will stop :( Any idea? I see that it refers to the db_backup function but a bit lost with the code :P Quote Advice on forum are Free, Email or Pm to fix your site is work...which I charge for :) ------------------- Link to comment Share on other sites More sharing options...
Jan Zonjee Posted March 9, 2008 Author Share Posted March 9, 2008 i tried to backup the db and it went fine, but when trying to restore it this is the error msg i had :" Error: File pointer for getting file offset cannot be read." And it will stop :( Any idea? I see that it refers to the db_backup function but a bit lost with the code :P To be honest I have no idea. From looking back at that function and where that error is generated the restore has already been underway for some time. At the time I even thought about throwing that out because the file pointer should be set and the checking for it superfluous (obviously not...): // Get the current file position if ($error == false) { $file_offset = ftell($fd); if (!$file_offset) { return array('status' => 'error', 'description' => ERROR_CANNOT_READ_FILE_POINTER, 'file_offset' => $file_offset); $error = true; When does it occur? On the first "run" of the restore, does it come up immediately or after about 25 seconds (when the end of the "run" should be near)? Quote Link to comment Share on other sites More sharing options...
Freeman Posted March 9, 2008 Share Posted March 9, 2008 at start...no gap if you are online i'm quite sure we can troubleshoot it really fast since i'm a developer myself (not experienced like you probably) read pvt msg :) Quote Advice on forum are Free, Email or Pm to fix your site is work...which I charge for :) ------------------- Link to comment Share on other sites More sharing options...
shpy Posted March 12, 2008 Share Posted March 12, 2008 Hi, what is difference of original backup and this ?! I mean, the size of the backup files. If use the original, i have a 3MB file. After install, the size is ~2.2MB ! All are in SQL only (not compresed). With the giude of this contribution, i change the Gzip path in admin/includes/applicationtop.php and Backup manager found GZipp function. But it cannt use it. When backup not download and use Gzip, it did not create any file. If Gzip and just download, it load a 611 byte *.gz file. If i don't change Gzipp path, the Gzip function disappeare. How's about that? Quote Paint for VietNamese : Link to comment Share on other sites More sharing options...
Guest Posted April 3, 2008 Share Posted April 3, 2008 Hi I downloaded your contribution and made a back up. But now I am concerned because the backup is only 2.8 mb against the 7 mb of the previous backup. Why did this happen? I am scared to restore the back up because it might not restore everything. Quote Link to comment Share on other sites More sharing options...
shpy Posted April 6, 2008 Share Posted April 6, 2008 i found that this backup manager will not backup all tables and all content of these tables ! So, i must found the way to comeback the original backup manager ! Quote Paint for VietNamese : Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 6, 2008 Author Share Posted April 6, 2008 i found that this backup manager will not backup all tables and all content of these tables ! So, i must found the way to comeback the original backup manager ! Getting back the original backup manager is easy enough. Just replace the admin/backup.php with the original one (or download osC 2.2 RC2a and use the one from that). Only one original define is commented out in the language file for the contribution, probably you will never need that one. Is there a pattern about certain tables/contents not being backed up? Some tables (sessions and whosonline) are not supposed to be backed up. They are also not backed up by more recent versions of backup.php. The difference in size in backup (2.2 instead of 3) as mentioned in your earlier post (missed that, sorry) is due to more efficient storing of the values in the tables as explained in the package itself. Quote Link to comment Share on other sites More sharing options...
shpy Posted April 6, 2008 Share Posted April 6, 2008 Thank you for reply. That's my fault ! I'm sorry, I did not read carefuly the install.txt . Yes, the whos_online table was not backed up. My site have the html_cace contribution (which add some colums to this table), when restore the database to the new site, the struture of database miss the whos_online table's. And the Admin Acess contribute have that issue too. There is any way for me backup all tables in my database ? (Thanks again for explain why new backup file smaler than the older. Now i understand it) Quote Paint for VietNamese : Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 6, 2008 Author Share Posted April 6, 2008 Yes, the whos_online table was not backed up. My site have the html_cace contribution (which add some colums to this table), when restore the database to the new site, the struture of database miss the whos_online table's. And the Admin Acess contribute have that issue too. There is any way for me backup all tables in my database ? Thanks for your reply and feedback. I now realize I was not completely right about the original backup.php not backing up sessions and whos_online because it does backup the structure of the table, only not the contents. With this contribution also the structure is not added (because of the way the code was put together with more flexibility of which tables you want to backup). I think I should go back and see if that can be added in again. It is not really a problem if you restore a backup over your present backup because then it will first get the structure of the table sessions and whos_online with a certain command, drop the table and then restore the backup without contents but with the changes you have made to the table. However, this doesn't work if you take the backup and use it on an empty database. My fault, haven't thought about that. For restoring the original tables sessions and whos_online you can use the queries from oscommerce.sql (the install sql file): DROP TABLE IF EXISTS sessions; CREATE TABLE sessions ( sesskey varchar(32) NOT NULL, expiry int(11) unsigned NOT NULL, value text NOT NULL, PRIMARY KEY (sesskey) ); DROP TABLE IF EXISTS whos_online; CREATE TABLE whos_online ( customer_id int, full_name varchar(64) NOT NULL, session_id varchar(128) NOT NULL, ip_address varchar(15) NOT NULL, time_entry varchar(14) NOT NULL, time_last_click varchar(14) NOT NULL, last_page_url text NOT NULL ); If you then run the portion of the sql of the html_cache contribution that changes the table whos_online (or add it to the code above) you should be fine. I'm not familiar with the Admin Access contribution but this database manager will backup all tables from the database, whether they are originally in osCommerce or not. Only not sessions and whos_online. Quote Link to comment Share on other sites More sharing options...
invasi0n Posted April 16, 2008 Share Posted April 16, 2008 (edited) Hello, I just tried this contribution with safe_mode ON and I get this error: Fatal error: Maximum execution time of 60 seconds exceeded in F:\xampp\htdocs\... Database size is 1.8 MB. I use firefox and JavaScript is enabled. If I turn safe_mode Off, it works without problems. Edited April 16, 2008 by invasi0n Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 27, 2008 Author Share Posted April 27, 2008 I just tried this contribution with safe_mode ON and I get this error: Fatal error: Maximum execution time of 60 seconds exceeded in F:\xampp\htdocs\... Database size is 1.8 MB. I use firefox and JavaScript is enabled. If I turn safe_mode Off, it works without problems. The idea was that the code would find out by itself if safe_mode was on or off with line 24: $safe_mode_setting = (@ini_get('safe_mode') == 'On' || (@ini_get('safe_mode') === 1)) ? true : false; Apparently, there are even more ways to set safe mode settings :'( Quote Link to comment Share on other sites More sharing options...
spooks Posted June 1, 2008 Share Posted June 1, 2008 (edited) Hi, thanks for the SQL, I`ve partially installed onto my test server (it timed out) but I think I`ve got sufficient for the test. Autobackup is now creating 15Mb (Uncompressed) backups, they are still complete, using with your gzip still works great. I do have a problem with your backup though, others seem to have had this as well, it stops partway through, so I only ever get a partial backup. It always stops at the same point, during the 'product_options' table, possibly of note is that the name is incomplete too, it shows 'product_opt' Site is in safe mode & register_globals cannot be enabled, its a shared server. I have tried the mod you mentioned ealier. I also noted your backups are quite slow compared to autobackup, perhaps you could look at using the routine in autobackup for backups? There is still a conflict remaining betwenn these two progs, the partial confuses autobackup into making extra backups. So I did disable for my tests of your backup routine. :unsure: Edited June 1, 2008 by spooks Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 1, 2008 Author Share Posted June 1, 2008 I do have a problem with your backup though, others seem to have had this as well, it stops partway through, so I only ever get a partial backup. It always stops at the same point, during the 'product_options' table, possibly of note is that the name is incomplete too, it shows 'product_opt' Site is in safe mode & register_globals cannot be enabled, its a shared server. I have tried the mod you mentioned ealier. That is a weird error. Can you send or post the last couple of lines of your backups, where it fails? Perhaps that gives a clue about why the code fails. I also noted your backups are quite slow compared to autobackup, perhaps you could look at using the routine in autobackup for backups? The one in autobackup is the one from standard osC and it generates a line (and in the restore a query) for every row in a table. This one makes a line with values for 20 rows so at least the restore should be faster :) Although I haven't time the difference, I'm still surprised that mine is slower, although it has more code to keep track of the time and number of rows. There is still a conflict remaining betwenn these two progs, the partial confuses autobackup into making extra backups. So I did disable for my tests of your backup routine. Yes, the partial stuff is rather complex and not necessary in your case. Quote Link to comment Share on other sites More sharing options...
spooks Posted June 1, 2008 Share Posted June 1, 2008 That is a weird error. Can you send or post the last couple of lines of your backups, where it fails? Perhaps that gives a clue about why the code fails. The one in autobackup is the one from standard osC and it generates a line (and in the restore a query) for every row in a table. This one makes a line with values for 20 rows so at least the restore should be faster :) Although I haven't time the difference, I'm still surprised that mine is slower, although it has more code to keep track of the time and number of rows. Yes, the partial stuff is rather complex and not necessary in your case. OK, I`ve now got your full SQL installed (did it in stages) autobackup still had no errors, backup took 25secs created a 43Mb file,gzipped OK. Yours was slighly quicker on this size file (reported 19.1secs) size was 20Mb and shows on list as partial_db_usename_osc1-200806012226.sql (I took secs off, don't see point of them) with table list of address_book, address_format, administrators, banners, banners_history, categories, categories_description, configuration, configuration_group, counter, counter_history, countries, currencies, customers, customers_basket, customers_basket_attributes, customers_info, digitemp, geo_zones, languages, link_categories, link_categories_description, links, links_check, links_description, links_featured, links_status, links_to_link_categories, manufacturers, manufacturers_info, menu, menu_colors, newsdesk, newsdesk_categories, newsdesk_categories_description, newsdesk_configuration, newsdesk_configuration_group, newsdesk_description, newsdesk_reviews, newsdesk_reviews_description, newsdesk_to_categories, newsletters, orders, orders_products, orders_products_attributes, orders_products_download, orders_status, orders_status_history, orders_total, page_description, products, products_attributes, products_attributes_download, products_description, products_notifications, products_options, products_o Having checked this file it does actually seem to be a full backup. If I select gzip it works at this size, with the original small dbase it does nothing (original remains). Perhaps this is actually more of a table list issue? Another issue is if I select download of 20Mb file it fails, if I gzip it it works? Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
spooks Posted June 2, 2008 Share Posted June 2, 2008 I`ve now installed on another site which also has a fairly small dbase, backups are OK but there is still the problem with the table list, there is also the download issue, ie select to download on backup uncompressed, nothing appears but sql put on server, do the same with gzip selected & it works. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.