Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Contribution: Auto Backup Database


spooks

Recommended Posts

Hi!

 

Lets say that because of a mod I implemented, I had to add extra columns, or even tables to my database. Would this add-on still work, i.e. would it backup column names or tables that are not originally in the stock install?

Link to comment
Share on other sites

  • 3 weeks later...

Hi Spooks,

 

it seems that eregi_replace function has been deprecated in PHP5.3. Can you help to replace it? It is suggested to use the function ereg_replace() instead but I'm not very familiar with the pattern to use.

 

Br,

Link to comment
Share on other sites

  • 2 weeks later...

Hi Spooks,

 

it seems that eregi_replace function has been deprecated in PHP5.3. Can you help to replace it? It is suggested to use the function ereg_replace() instead but I'm not very familiar with the pattern to use.

 

Br,

Can someone help?

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

 

I have tried on 2 occasions to add this contribution with no luck. I have reviewed it over & over again and everything is where it should be ?

 

After following all the steps, I receive the following error message when I tried to sign into my web admin.

 

Parse error: syntax error, unexpected T_STRING in /home/sunshyn1/public_html/XXXXXX/includes/application_top.php on line 231

 

 

 

When I go into my

 

/home/sunshyn1/public_html/XXXXXX/includes/application_top.php

 

and remove the following I am able to sign into my admin but I do not have any backup features

 

 

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

 

This will only work if you log in to admin & create a admin session, if you use cpanel to log in you won't create the session, so to get around that, replace the above with:

 

require(DIR_WS_INCLUDES .'auto_backup_db.php');

 

 

Needless to say I am stumped. Any idea what I am doing wrong or can do to correct the problem.

 

Thank you in advance,

Tracie

Link to comment
Share on other sites

  • 4 weeks later...

Can someone help?

 

Thanks!

 

 

I usually copy original code and then copy it out. That is the code you see below.

Try the following (should work, but I didn't test):

 

//$at_entry = eregi_replace(DB_DATABASE . '[_-]', '', $at_entry);

//$at_entry = eregi_replace('[.a-z]', '', $at_entry);

$at_entry = preg_replace(DB_DATABASE . '/[_-]/', '', $at_entry);

$at_entry = preg_replace('/[.a-z]/', '', $at_entry);

$at_last = strstr($at_last, DB_DATABASE);

//$at_last = eregi_replace(DB_DATABASE . '[_-]', '', $at_last);

//$at_last = eregi_replace('[.a-z]', '', $at_last);

$at_last = preg_replace(DB_DATABASE . '[_-]', '', $at_last);

$at_last = preg_replace('/[.a-z]/', '', $at_last);

Link to comment
Share on other sites

I usually copy original code and then copy it out. That is the code you see below.

Try the following (should work, but I didn't test):

 

//$at_entry = eregi_replace(DB_DATABASE . '[_-]', '', $at_entry);

//$at_entry = eregi_replace('[.a-z]', '', $at_entry);

$at_entry = preg_replace(DB_DATABASE . '/[_-]/', '', $at_entry);

$at_entry = preg_replace('/[.a-z]/', '', $at_entry);

$at_last = strstr($at_last, DB_DATABASE);

//$at_last = eregi_replace(DB_DATABASE . '[_-]', '', $at_last);

//$at_last = eregi_replace('[.a-z]', '', $at_last);

$at_last = preg_replace(DB_DATABASE . '[_-]', '', $at_last);

$at_last = preg_replace('/[.a-z]/', '', $at_last);

 

 

Actually it appears I was wrong because I am getting errors.

Instructions can be found here by Spooks:

http://www.oscommerce.com/forums/topic/303380-contribution-auto-backup-database/page__st__100

 

I tried it, I am not getting errors now.

Link to comment
Share on other sites

  • 2 months later...

Hi, thanks for a great addon.

 

I have a heavily modded site I and trying to get this installed on and I get an error when I try and run the auto_backup_setup.php file.

I also get it when logging in and out sometimes.

If I am logging in and it happens and I press F5 to refresh then it shows the administration screen and I can carry on as normal.

 

I get

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

The error log says

Premature end of script headers: index.php

Premature end of script headers: login.php, referer: http://domainname/shop/admin/index.php

Premature end of script headers: auto_backup_setup.php

 

I have managed to install to another website with not very many mods, and it works well, doing backups.

 

Have renamed function bu_gzip to bu_gzip2 and also in auto_backup_db.php as I have Site Monitor installed.

 

Just wondering if you could possibly point me in the right direction to sort this out.

 

Many thanks.

 

Kezza

Currently running version 2.3.3

 

Addons installed in order

1 UK Quick Localisation, 2 Stock for Shop, 3 UK Royal Mail & Overseas Shipping Methods 21st Aug Prices, 4 myHermes Shipping Rates

5 Quickly Update Product Stock, 6 Ultimate SEO URLs – INSTALLED, 7 Google XML Sitemap w/ Admin, 8 SysCheck, 9 Secure your site with an IP trap, 10 Sam's Anti-hacker Account Mods, 11 Spiders txt, 12 Google Analytics, 13 Monthly Sales/Tax Report for 2.3.1

 

Addons installed

Add New Page – About Us, Admin Notes 2.5, Admin SpiffyCal v3.34, Discount Coupon Codes 3.34 for osc 2.31, Google Base / Froogle Data Feeder v1.00, Google Breadcrumb, Google Feed Account Setup, Install the Discount Coupon order total module, Keyword Search Report v.1.7 for 2.3, KissMT Dynamic SEO Meta & Canonical Header Tags, Multiple dropdown configuration, Product Attributes Tabs, Product Cycle Slideshow Box, Recover Cart Sales V2.23d, SiteMonitor, Tag Cloud, Theme Switcher, Total Configuration, Tracking Module 2.3 - Royal Mail, Tracking Module for 2.3, Updated spiders.txt

Link to comment
Share on other sites

  • 2 weeks later...

Hi, I also have an email sent that has some error lines in.

 

PHP Notice: Use of undefined constant STORE_NAME - assumed 'STORE_NAME' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 50

PHP Notice: Use of undefined constant REVIEW_TEXT_MIN_LENGTH - assumed 'REVIEW_TEXT_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 149

PHP Notice: Use of undefined constant ENTRY_FIRST_NAME_MIN_LENGTH - assumed 'ENTRY_FIRST_NAME_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 168

PHP Notice: Use of undefined constant ENTRY_LAST_NAME_MIN_LENGTH - assumed 'ENTRY_LAST_NAME_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 169

PHP Notice: Use of undefined constant ENTRY_EMAIL_ADDRESS_MIN_LENGTH - assumed 'ENTRY_EMAIL_ADDRESS_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 171

PHP Notice: Use of undefined constant ENTRY_STREET_ADDRESS_MIN_LENGTH - assumed 'ENTRY_STREET_ADDRESS_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 172

PHP Notice: Use of undefined constant ENTRY_POSTCODE_MIN_LENGTH - assumed 'ENTRY_POSTCODE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 173

PHP Notice: Use of undefined constant ENTRY_CITY_MIN_LENGTH - assumed 'ENTRY_CITY_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 174

PHP Notice: Use of undefined constant ENTRY_TELEPHONE_MIN_LENGTH - assumed 'ENTRY_TELEPHONE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 179

PHP Notice: Use of undefined constant ENTRY_PASSWORD_MIN_LENGTH - assumed 'ENTRY_PASSWORD_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 180

PHP Notice: Use of undefined constant ENTRY_FIRST_NAME_MIN_LENGTH - assumed 'ENTRY_FIRST_NAME_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 198

PHP Notice: Use of undefined constant ENTRY_LAST_NAME_MIN_LENGTH - assumed 'ENTRY_LAST_NAME_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 201

PHP Notice: Use of undefined constant ENTRY_EMAIL_ADDRESS_MIN_LENGTH - assumed 'ENTRY_EMAIL_ADDRESS_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 207

PHP Notice: Use of undefined constant ENTRY_STREET_ADDRESS_MIN_LENGTH - assumed 'ENTRY_STREET_ADDRESS_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 212

PHP Notice: Use of undefined constant ENTRY_POSTCODE_MIN_LENGTH - assumed 'ENTRY_POSTCODE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 217

PHP Notice: Use of undefined constant ENTRY_CITY_MIN_LENGTH - assumed 'ENTRY_CITY_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 220

PHP Notice: Use of undefined constant ENTRY_STATE_MIN_LENGTH - assumed 'ENTRY_STATE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 223

PHP Notice: Use of undefined constant ENTRY_TELEPHONE_MIN_LENGTH - assumed 'ENTRY_TELEPHONE_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 230

PHP Notice: Use of undefined constant ENTRY_PASSWORD_MIN_LENGTH - assumed 'ENTRY_PASSWORD_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 239

PHP Notice: Use of undefined constant ENTRY_PASSWORD_MIN_LENGTH - assumed 'ENTRY_PASSWORD_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 246

PHP Notice: Use of undefined constant ENTRY_PASSWORD_MIN_LENGTH - assumed 'ENTRY_PASSWORD_MIN_LENGTH' in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 249

PHP Fatal error: Call to undefined function tep_href_link() in servername/domainname.com/public/vcatalog/324_admin-GWER/includes/languages/english.php on line 433

 

Any help for this would be appreciated.

 

Kezza

Currently running version 2.3.3

 

Addons installed in order

1 UK Quick Localisation, 2 Stock for Shop, 3 UK Royal Mail & Overseas Shipping Methods 21st Aug Prices, 4 myHermes Shipping Rates

5 Quickly Update Product Stock, 6 Ultimate SEO URLs – INSTALLED, 7 Google XML Sitemap w/ Admin, 8 SysCheck, 9 Secure your site with an IP trap, 10 Sam's Anti-hacker Account Mods, 11 Spiders txt, 12 Google Analytics, 13 Monthly Sales/Tax Report for 2.3.1

 

Addons installed

Add New Page – About Us, Admin Notes 2.5, Admin SpiffyCal v3.34, Discount Coupon Codes 3.34 for osc 2.31, Google Base / Froogle Data Feeder v1.00, Google Breadcrumb, Google Feed Account Setup, Install the Discount Coupon order total module, Keyword Search Report v.1.7 for 2.3, KissMT Dynamic SEO Meta & Canonical Header Tags, Multiple dropdown configuration, Product Attributes Tabs, Product Cycle Slideshow Box, Recover Cart Sales V2.23d, SiteMonitor, Tag Cloud, Theme Switcher, Total Configuration, Tracking Module 2.3 - Royal Mail, Tracking Module for 2.3, Updated spiders.txt

Link to comment
Share on other sites

  • 5 months later...

Auto Backup Database (Updated) V4 :)

 

Code re-written, now faster & more efficient (un-compressed backups are upto 50% smaller) backups take approx 1.5 secs per Mb (un-compressed).

 

Automatically backs up your database at regular intervals whilst you are logged into admin and create archive backups at a longer intervals.

Backups can be GZipped to conserve server space.

Backups can now be split or extended past max execution time if you have a very large dBase.

Backups are compatible with Database Backup Manager so selective restores can be made.

A cron job can also be set up to create timed daily backups, regardless of whether anyone logs in or not.

Archived backups can now also be auto deleted after a set period, so server won't fill up.

The 'sessions' and 'whos_online' tables are now automatically excluded from auto-backups, other exclusions can easily be added if needed.

The backup status is now only checked once every 5 minutes instead of on every page load.

As logfiles are created in the backup folder, modifications to Database Backup Manager are included to enable display/deletion of same.

Now includes separate language file to ease alterations for non English speakers.

 

Basic install is just 5 easy steps.

 

Compatible with all osC versions 2.3.1 and below.

 

Contribution found at http://addons.oscommerce.com/info/8374

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

@mr_absinthe

 

Good, there shouldn't be any issues, I could have mentioned before this has been tested with a 30Mb+ database of over 500,000 rows (average backup time was just over 30 secs)

 

The only case I`ve not setup for is if anyone has a very large database that would need a split backup and they don't use sessions for admin, but does anyone still do that?

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 is running fine on php 5.3.10, no issues so far. However on my other store with php 5.2.9, it does nothing. I've tried changing settings and still, nothing. Any idea please?

Edited by mr_absinthe

Absinthe Original Liquor Store

Link to comment
Share on other sites

I have it running on a number of servers without issue, did the setup confirm that everything was OK including the application_top change?

 

How are you logging into the server, ie are you using sessions or cpanel

 

Are there any existing backups, if so they will still be looked at to ascertain if any are due.

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

Yes, there are existing backups, there is a cron that does backup on hourly basis. I've deleted the backup, played with the backup interval and all seems to be fine now, thanks! :thumbsup:

 

It would be great if the backup file could be sent by email :shifty:

Edited by mr_absinthe

Absinthe Original Liquor Store

Link to comment
Share on other sites

Glad you have confirmed its working OK :thumbsup:

 

I don't want to make the auto-backup file any bigger than it absolutely has to, it would be feasible to add an email option to Database Backup Manager

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...

Auto Backup Database (Updated) V4.1 released :) http://addons.oscommerce.com/info/8374

 

Code re-written, now faster & more efficient (un-compressed backups are upto 50% smaller) backups take approx 1.5 secs per Mb (un-compressed).

 

Automatically backs up your database at regular intervals whilst you are logged into admin and create archive backups at a longer intervals.

Backups can be GZipped to conserve server space.

Backups can now be split or extended past max execution time if you have a very large dBase.

Backups are compatible with Database Backup Manager so selective restores can be made.

A cron job can also be set up to create timed daily backups, regardless of whether anyone logs in or not.

Cron job backups can be automatically emailed on completion

Archived backups can now also be auto deleted after a set period, so server won't fill up.

The 'sessions' and 'whos_online' tables are now automatically excluded from auto-backups, other exclusions can easily be added if needed.

The backup status is now only checked once every 5 minutes instead of on every page load.

As logfiles are created in the backup folder, modifications to Database Backup Manager are included to enable display/deletion of same.

Added email backup feature to Database Backup Manager

Now includes separate language file to ease alterations for non English speakers.

 

Basic install is just 7 easy steps.

 

Compatible with all osC versions 2.3.1 and below.

 

Changes in Version 4.1

  • Made database read more robust against malformed database entries.
  • Added 'Test Run' button to Auto Backup Setup which makes a forced run so users can easily confirm operation.
  • Added email backup feature to Database Backup Manager.
  • Added option to email backup on completion of cron job.
  • Fixed minor bug in cron job, erroneous function call made when creating backup complete message.

 

 

Contribution found at http://addons.oscommerce.com/info/8374

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

 

just installed version 4.1 on my local test site and when I run auto_backup_setup I get an error

 

1048 - Column 'set_function' cannot be null

 

INSERT INTO `configuration` (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ('Auto Backup Interval', 'BACKUP_INTERVAL', '20', 'Alter the automatic dBase backup interval in minutes, i.e. 20mins (5 mins minimum).

 

When a new backup is created the previous interim one is deleted, subject to the Backup Archive Interval', '8675310', 30, NULL, now(), NULL, NULL)

 

[TEP STOP]

 

 

I'm using RC2a

 

Can anyone help

 

Thanks

 

Ian

Edited by ianric
Link to comment
Share on other sites

@@ianric

 

It would appear you have a non-standard database structure!

 

'set_function' is often null

 

This is the standard with osC2.3

 

CREATE TABLE IF NOT EXISTS `configuration` (
 `configuration_id` int(11) NOT NULL AUTO_INCREMENT,
 `configuration_title` varchar(255) NOT NULL,
 `configuration_key` varchar(255) NOT NULL,
 `configuration_value` text NOT NULL,
 `configuration_description` varchar(255) NOT NULL,
 `configuration_group_id` int(11) NOT NULL,
 `sort_order` int(5) DEFAULT NULL,
 `last_modified` datetime DEFAULT NULL,
 `date_added` datetime NOT NULL,
 `use_function` varchar(255) DEFAULT NULL,
 `set_function` varchar(255) DEFAULT NULL,
 PRIMARY KEY (`configuration_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;

 

It would seem in you database you have 'set_function' with a NOT NULL alter that with phpMyAdmin, most addons using SQL changes will fail otherwise.

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

You can delete it if you wish, it wont do any harm either 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

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...