Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Contribution: Auto Backup Database


spooks

Recommended Posts

i did at line 75 what you said :

 

- now when i select gzip or false, i got a saved database each time i go to a page in admin

- if i select zip, i got a save in pure sql mode , with the message shown below, but i think it s not reveleant it s just that the variables not selected in admin configuration are not defined :

 

Notice: Undefined variable: zip in v:\easyphp\www\ms2fr\shop\admin\includes\auto_backup_db.php on line 167

 

Notice: Undefined variable: gzip in v:\easyphp\www\ms2fr\shop\admin\includes\auto_backup_db.php on line 167

 

line 168 is :

 

$database_saved =' Database Backup is completed' . ($zip ? ' and zipped.' : ($gzip ? ' and gzipped.' : '.'));

 

 

* notice-> even if at the beginning the backup folder was empty , the backup save files

 

* by the way the link here :

<a href="backups/'.$at_backup_file.

 

should be using : DIR_FS_BACKUP instead no ?

 

* last error sown :

 

Use of undefined constant SUCCESS_DATABASE_SAVING - assumed 'SUCCESS_DATABASE_SAVING' in v:\easyphp\www\ms2fr\shop\admin\includes\auto_backup_db.php on line 79

 

it s true i got written when the database saves itself only :

 

Avertissement SUCCESS_DATABASE_SAVING

Succès Database Backup is completed and gzipped.: Check SQL

MS2

Link to comment
Share on other sites

More variables want defing? I`ll be glad when php4 gets dropped altogether later this year.

 

To fix undefined variables just add $zip = NULL;$gzip = NULL; to line 75

 

The program creates an uncompressed backup first, if you select zip it then attempts to zip that & deletes it on success.

If there is any failure in the zip operation the uncompressed backup wont be deleted.

 

If your saving to the wrong location its your config thats the error.

 

The file is saved to: DIR_FS_BACKUP . $at_backup_file

 

$at_backup_file is set to the file name by the program, DIR_FS_BACKUP is set in your configure.php this is normally:

define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');

So you casn see if DIR_FS_ADMIN is not set you`ll get your problem, its normall set to:

/catalog/admin/

 

Hope that improves matters

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

* by the way the link here :

 

here is your code :

$messageStack->add_session($database_saved.': <a href="backups/'.$at_backup_file.'" target="_blank"><blink><b>Check SQL</b></blink></a>', 'success');

 

as you can see the DIR_FS_BACKUP is not use, instead you use :

href="backups/'.$at_backup_file.'

 

hope you understand what i mean

 

*

If there is any failure in the zip operation the uncompressed backup wont be deleted.

clever :-)

 

*

I`ll be glad when php4 gets dropped altogether later this year.

well i dont know for ms3 requirement but i think its going on with what you say...

 

* what about last error shown, it can give us info, since you define the SUCCESS_DATABASE_SAVING variable, how it can be undefined, that means that

the website never reach the line you got setup:

 

define('SUCCESS_DATABASE_SAVING', 'ATTENTION: Making a Auto-Backup of your Database ... ( ' . ($hr_dif ? $hr_dif . ' Hrs ' : '') . $mn_dif  . ' minutes since last backup ).');

 

 

Use of undefined constant SUCCESS_DATABASE_SAVING - assumed 'SUCCESS_DATABASE_SAVING' in v:\easyphp\www\ms2fr\shop\admin\includes\auto_backup_db.php on line 79

MS2

Link to comment
Share on other sites

Sorry, a little language issue there mayby, I thought you were talking about an earlier point.

 

* by the way the link here :

 

here is your code :

as you can see the DIR_FS_BACKUP is not use, instead you use :

href="backups/'.$at_backup_file.'

 

hope you understand what i mean

 

I'm not sure if this is a osC version issue, I`m using 2.2rc1. So that code gives correct link like:

http://www.mysite.co.uk/catalog/admin/back...06011749.sql.gz

 

if it was set to: <a href="'.DIR_FS_BACKUP.$at_backup_file.'"

it would give a link of:

http://www.mysite.co.uk/home/uname/public_...06011753.sql.gz

 

which would be no good.

 

* what about last error shown, it can give us info, since you define the SUCCESS_DATABASE_SAVING variable, how it can be undefined, that means that

the website never reach the line you got setup:

 

define('SUCCESS_DATABASE_SAVING', 'ATTENTION: Making a Auto-Backup of your Database ... ( ' . ($hr_dif ? $hr_dif . ' Hrs ' : '') . $mn_dif  . ' minutes since last backup ).');

 

This is only occuring with the temporary mod I asked you to do, if you remove the '$at_backup_db = 'at_backupnow' from line 75, the normal timing will work again, and so the define will be done. You should not get your initial errors as you know have backup files for it to work with.

 

:)

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

Hi guys,

 

This is a great mod to have, I only wish I had it installed yesterday after a database issue and of course my latest back up was 3 days old. :)

 

Any how I installed this mod today (Auto Backup Install V2.5) and it doesn't appear to be creating backups.

 

I left the settings as is. I checked the admin to see if it created a new back up (it didn't) I than went into the FTP to see if it created a backup and it hasn't.

 

I have been doing a bunch of work in the admin area. Could this be the problem?

 

After running auto_backup_setup.php I deleted it, should I have?

 

 

thanks for the assistance.

Sincerely

Mike

Link to comment
Share on other sites

Hi guys,

 

This is a great mod to have, I only wish I had it installed yesterday after a database issue and of course my latest back up was 3 days old. :)

 

Any how I installed this mod today (Auto Backup Install V2.5) and it doesn't appear to be creating backups.

 

I left the settings as is. I checked the admin to see if it created a new back up (it didn't) I than went into the FTP to see if it created a backup and it hasn't.

 

I have been doing a bunch of work in the admin area. Could this be the problem?

 

After running auto_backup_setup.php I deleted it, should I have?

 

 

thanks for the assistance.

 

Have you made the changes to application_top.php ?

 

What are your software versions?

 

It should make the first backup strait away, there are still some issues with php4 though.

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

Have you made the changes to application_top.php ?

 

What are your software versions?

 

It should make the first backup strait away, there are still some issues with php4 though.

 

Hi Sam,

 

Thank you for the hand.

 

To be honest I am not 100 % sure which version we are running, is there a prefered file I should look at to see the version I am using? I know it is milestone 2 +.

 

 

The application_top was updated with

if (tep_session_is_registered('admin')) require(DIR_WS_INCLUDES .'auto_backup_db.php');

 

 

I used the cpanel protected directory to log into the admin, this wouldn't cause a problem would it?

 

My PHP version is 5.2.6

Sincerely

Mike

Link to comment
Share on other sites

Hi Sam,

 

Thank you for the hand.

 

To be honest I am not 100 % sure which version we are running, is there a prefered file I should look at to see the version I am using? I know it is milestone 2 +.

 

 

The application_top was updated with

if (tep_session_is_registered('admin')) require(DIR_WS_INCLUDES .'auto_backup_db.php');

 

 

I used the cpanel protected directory to log into the admin, this wouldn't cause a problem would it?

 

My PHP version is 5.2.6

 

It should work fine with your versions.

 

That could be the cpanel log in, its looking for an admin session, if you hav`ent created one it wont run, if thats a problem just modify the application_top code to:

require(DIR_WS_INCLUDES .'auto_backup_db.php');

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

It should work fine with your versions.

 

That could be the cpanel log in, its looking for an admin session, if you hav`ent created one it wont run, if thats a problem just modify the application_top code to:

require(DIR_WS_INCLUDES .'auto_backup_db.php');

 

You the man! That did the trick. It backed up instantly.

 

thanks!

 

If you decide to update the mod instructions with this, I noticed a minor spelling error.

 

When you go to admin/configuration/auto backup

 

Auto Backup Interval

Alter the automatic dBase backup interval in minites.

 

Should be a u.

 

thanks again and great mod!

Sincerely

Mike

Link to comment
Share on other sites

I`ve now put up V2.6 which should hopfully be OK with your PHP4, if you try it let me know if its all OK.

 

:)

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

hi first let me thank you for the effort of providing a contribution compatible ith php4 !

 

i installed version 2.6, since even when puting the interval to 1 mn doesnt save, i again tested with

$at_backup_db = 'at_backupnow';

 

now i can see a difference :

 

- if there was no database in backup folder, one NOT gziped (pure sql) is saved, then other are gzip since i selected gzip from admin option

- at first time the mesage is shown : ATTENTION: Making the first Auto-Backup of your Database

- but for other times , its a blanck message ( maybe because of the $at_backup_db = 'at_backupnow'; trick)

 

any idea why it doesnt save every Minutes when i put one minutes in

MS2

Link to comment
Share on other sites

Hello,

 

I have installed the latest version (2.6) but am not really sure what I am missing....I dont see any backups happening automatically.

 

After running auto backup setup, it says all is OK and directory is writable etc, but I dont see any backups happenning.

 

Anything else I need to configure ?

 

My admin/backups directory has several backup files, some gzip or some without gzip format.

 

Anyone ?

 

 

dca

 

 

I`ve now put up V2.6 which should hopfully be OK with your PHP4, if you try it let me know if its all OK.

 

:)

Link to comment
Share on other sites

hi first let me thank you for the effort of providing a contribution compatible ith php4 !

 

i installed version 2.6, since even when puting the interval to 1 mn doesnt save, i again tested with

$at_backup_db = 'at_backupnow';

 

now i can see a difference :

 

- if there was no database in backup folder, one NOT gziped (pure sql) is saved, then other are gzip since i selected gzip from admin option

- at first time the mesage is shown : ATTENTION: Making the first Auto-Backup of your Database

- but for other times , its a blanck message ( maybe because of the $at_backup_db = 'at_backupnow'; trick)

 

any idea why it doesnt save every Minutes when i put one minutes in

 

That`s anoying, still bugs with PHP4! Adding $at_backup_db = 'at_backupnow'; bypasses the timer functions, one you have some backups for the program to 'see' remove that line and things should be OK. The backup only occurs on a page load, so if you set interval to 1 minute, they will only occur every minite of you navigate between admin pages at least one a minite.

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

No, It should do strait away. What version of PHP do you have?

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

4.4.4

 

Try the latest version (2.7) its got some extra code to try & get round problems with the older versions of PHP

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

  • 2 weeks later...

Uploaded V2.8

 

Having gained access to a server with PHP 4 I`ve finally been able to remove last remaining bug with php 4, it was a little documented variation in a timeing function.

 

This has now been tested on PHP 4 & 5, SQL 4 & 5, osC 2.2 ms2 & rc1 and is register_globals compatible so should work with most versions.

 

B)

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

hello

do i got to keep this line 94 since i got php 4 ::

if (PHP_VERSION < '5' && $at_total < 1) {$at_backup_db = 'at_backupnow';$saving = 'ATTENTION: Making the initial Auto-Backups of your Database.'; } }

MS2

Link to comment
Share on other sites

hello

do i got to keep this line 94 since i got php 4 ::

if (PHP_VERSION < '5' && $at_total < 1) {$at_backup_db = 'at_backupnow';$saving = 'ATTENTION: Making the initial Auto-Backups of your Database.'; } }

 

 

No, thats not needed anymore as timing functions now work even with empty directory & php4, if you look at V2.8 you'll see its been removed.

 

:)

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

  • 5 weeks later...

Great contribution, thanks!

 

Quick question. When upgrading from 2.3 to 2.8, does 2.8 remove the sql installed data or still use it (from 2.3)? I am just wondering if that data should be pulled out or is it still used.

 

Also, any changes necessary if using a admin directory that is named something other than admin?

 

Thanks again.

 

Carry

Link to comment
Share on other sites

The setup will update if needed.

 

The backup directory used is the one defined in your configure.php file, so as long as that is correct its fine.

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

  • 3 weeks later...

Hi,

Is there an easy way to limit the number of archive backups stored? I have been deleting the older archives via the admin panel but it would be nice if you were able to do so automatically. Example: backup every hour, archive every day and only store last two archived backups. Great mod by the way.

Thanks

Link to comment
Share on other sites

Hi,

Is there an easy way to limit the number of archive backups stored? I have been deleting the older archives via the admin panel but it would be nice if you were able to do so automatically. Example: backup every hour, archive every day and only store last two archived backups. Great mod by the way.

Thanks

 

 

Its possible, but you would have to take care as you never know how far you have to go back. Following a query I`ve temporarily gone back a few weeks, could'nt do that if it went your way.

 

My approach is to use ftp, transfer archives to pc, then delete whole block at once, quicker that way.

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

  • 2 months later...
Its possible, but you would have to take care as you never know how far you have to go back. Following a query I`ve temporarily gone back a few weeks, could'nt do that if it went your way.

 

My approach is to use ftp, transfer archives to pc, then delete whole block at once, quicker that way.

 

 

I just installed the mod -- and it's great! I have the same question as the previous person, but I'm not sure I understand completly being that I have just installed the mod.

 

So if I set auto backup interval to 30, it will create a new backup twice an hour?

If I set backup save interval to 24, it will save just one of those backups every day and delete the others?

 

Is that correct?

 

So if I want to archive just 4 weeks of backups (nothing older than 28 days), how do I do that?

 

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...