Jump to content
spooks

Contribution: Auto Backup Database

Recommended Posts

Hey everyone, I've been playing around on my dev site trying to get another addon to work with 2.3.3.2 and ran into a couple problems restoring a backup.

1)I received the following error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/flournet/public_html/sandbox/snuffle_upagus/includes/functions/db_backup.php on line 166

1065 - Query was empty

 

I notice line 166 is

 

$create_table_result = mysql_fetch_array($create_table_query, MYSQL_NUM);

 

And, I believe (I'm not a coder) this should be changed for 2.3.3.2 to

 

 $create_table_result = tep_db_fetch_array($create_table_query, MYSQL_NUM);

 

I've changed in my dev site and tested and now works...

 

2)When restoring, leaving the

Do you want to empty the tables sessions and whos_online (advisable when doing a complete restore, will also reset the date and file used for last restore)?
defaulted "checked"

 

It seems to be deleting these tables completely... Not emptying...

 

When I leave the box "upchecked' I receive the following error

Error: no tables selected for restore

 

Can anyone confirm???

Share this post


Link to post
Share on other sites

I am having the hardest time installing this into a 2.3.3.4 store.

I upload all of the files, overwriting the files in the store, then I run the auto_backup_setup.php

 

Afterwards, Everything looks ok, and I get the green bar across the top, however, when I try to run a new backup, I get a server error

PHP Fatal error:  Call to undefined function tep_db_fetch_array_num() in /var/www/*******/*******/backup.php on line 184, referer: http://mtrosemedia.org/*******/*******/backup.php?action=backup

 

I reverted back to my backed up copy of backup.php, but nothing runs automatically. And now, I can't backup with compression, only uncompressed.

Share this post


Link to post
Share on other sites

I tried installing in oscommerce 2.3.3.4, but it gives me errors and not updated it to this version, right?

Share this post


Link to post
Share on other sites

I'm running into the same issues as in the last 3 posts in my local install using Xampp and oscommerce v2.3.4.

I'm using what I believe is the latest version by Snoopy: http://addons.oscommerce.com/info/8902/v,23

 

When I try to restore a backup, I get the error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in xampp/mylocalstore/includes/functions/db_backup.php on line 166

So I changed the two instances of  mysql_fetch_array to tep_db_fetch_array in the db_backup.php file, but when I try to restore the backup, now I get this error:

1146 - Table 'mystore.whos_online' doesn't exist

show create table `whos_online`

[TEP STOP]

Does anyone know how to fix this and update the addon to work with v2.3.4?

@@greasemonkey and @@Snoopy10, could you guys please help out?

 

TIA! :)

 

In time: when I uncheck the "Do you want to empty the tables sessions and whos_online" box, I'm able to restore the backup.

Edited by Patty

Patty

Share this post


Link to post
Share on other sites

Hi, Question..

 

I have set auto backup every 10 minutes when i'm working in admin.  All good.

 

Set Backup delete for 200 hours, but every time it's makes a backup the last backup made of 10 minutes ago is getting deleted. ?

 

Where is the problem.

 

Greetings, Anne

Share this post


Link to post
Share on other sites

@@Patty that is as far as I've got.

 

So when you restore just be sure to leave the "who's online and sessions option" UN-checked.

 

It sounds like that works for you? It does for me.

 

Hi there. Sorry I didn't reply before, just read this now. Tks for replying.

 

It works that way, but it seems to me it's a bug that should be fixed. ;)


Patty

Share this post


Link to post
Share on other sites

Uploaded new update:

WARNING: auto_backup_setup.php don't upgraded, I DON'T KNOW IF WORKS, DON'T USE IN LIVE STORE.

- Bootstraped Page - Bootstraped Buttons - Replaced array() to []

- Replaced require('file-path') to require 'file-path'

- Replaced require('file-path') to require 'file-path'

- Replaced XHTML Tags to HTML Tags - Added Spanish translations (partially)

Share this post


Link to post
Share on other sites
Posted (edited)
On 4/15/2020 at 1:40 PM, PiLLaO said:

Uploaded new update:

WARNING: auto_backup_setup.php don't upgraded, I DON'T KNOW IF WORKS, DON'T USE IN LIVE STORE.

- Bootstraped Page - Bootstraped Buttons - Replaced array() to []

- Replaced require('file-path') to require 'file-path'

- Replaced require('file-path') to require 'file-path'

- Replaced XHTML Tags to HTML Tags - Added Spanish translations (partially)

Unfortunately this is not working for Phoenix 1.0.56

I'm getting errors like

Notice: Undefined index: listing in C:\xampp\htdocs\phoenix\admin\backup.php on line 41

And when I try to restore a back up, it created an uncompressed back up file, but neither back ups can be restored:

Error: no tables selected for restore

Can someone please help making this addon compatible with Phoenix latest versions? This one should be made part of the project.

TIA! 

 

Edited by Patty

Patty

Share this post


Link to post
Share on other sites

For this error, replace line 41

  $listing = $_GET['listing'];

with this:

  $listing = $_GET['listing'] ?? '';

 

Share this post


Link to post
Share on other sites

Thank you! That fixed the Notice error.

But the addon still doesn't restore the database. Any fix for this?


Patty

Share this post


Link to post
Share on other sites

Sorry but I'm still upgrading into Phoenix, you can make the backups with the original backup tools until someone can fix this

Share this post


Link to post
Share on other sites

Yeah, but the point is to be able to use the automated backup. I also just started with Phoenix and I'm trying some useful addons.

Thanks anyway.


Patty

Share this post


Link to post
Share on other sites
On 4/18/2020 at 6:45 PM, Patty said:

And when I try to restore a back up, it created an uncompressed back up file, but neither back ups can be restored:

Error: no tables selected for restore

 

Can you check the backup file have data?

Uncompress the file and look at the sql file, please.

Share this post


Link to post
Share on other sites

Yes, it does. Both compressed and uncompressed files look fine.


Patty

Share this post


Link to post
Share on other sites

Seems to never works this function, at least as I can see on code, was mixing $_GET and $_POST at same time.

You must to find on catalog/admin/backup.php this line:

      // end if ($buInfo->table_list != TEXT_INFO_NO_INFORMATION)
        $contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_RESTORE, 'fas fa-file-upload', tep_href_link('backup.php', 'file=' . $buInfo->file . '&action=restorenow'), null, null, 'btn-warning mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('backup.php', 'file=' . $buInfo->file), null, null, 'btn-light')];

and replace by this:

      // end if ($buInfo->table_list != TEXT_INFO_NO_INFORMATION)
        $contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_RESTORE, 'fas fa-file-upload', tep_href_link('backup.php', 'file=' . $buInfo->file . '&action=restorenow&restore_all=1'), null, null, 'btn-warning mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('backup.php', 'file=' . $buInfo->file), null, null, 'btn-light')];

it's a dirty fix to make it works temporarily.

Share this post


Link to post
Share on other sites

Thank you! That worked! Uncompressed back up was restored!

But it won't restore the compressed back up file. Also it's forcing the restoring of all tables, not just the selected ones. 

Like you said, it's just a temporary fix, but the code should be reviewed to make it work as it's supposed too.

In any case, thank you for your help with this! Have a great week and stay safe! 😙


Patty

Share this post


Link to post
Share on other sites

I make the test with a gzip backup and it was restored correctly.

Can you choose the tables to restore?

can you share a screenshot and put the url without without your data?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×