phpMyBackup


phpMyBackup Version 1.01

updated 24 March 2003 - 16 April 2003

Original code © 2002 by Audun Larsen last updated on 16 April 2003 by Martin Norman -- http://www.normsland.co.uk/


NOTICE

The author cannot be held liable for any loss of data caused by using this software. Please use at your own risk. Please see the "QPL.txt" included in this archive for more information.



1...Introduction...

The company I work for has a database running on mySQL on our intranet webserver and I needed a script that could run off a few tables and not the entire database. Then upload them to our webserver and import them via a batch job.

If you've used phpMyBackup you'll know that it can two of the three things e.g. export the database and ftp it to another server but what it can't do is export individual tables from the database and then import the newest version automatically them via the command line (for a cron/batch job). That is why I have modified the original code to do this and more. Please see the changes section for more details.

I don't intend to update this version anymore than this. Feel free to use and reuse this code as outlined under the QPL license.


NOTE

When exporting a database or tables phpMyBackup AUTOMATICALLY adds DROP TABLE sql commands for tables. This is different from how the conventional version of phpMyBackup works. If you don't want it dropping database tables before importing them then stick to the original version of phpMyBackup.



2...Download...

5wire.co.uk Web Hosting - Wordpress, PHP, MySQL Support - Domain Registration - Dedicated Servers - Cloud Hosting

Click below to download the zip file.

Downloads: 8967
phpMyBackup 18.5kb



3...Installation...

Simply copy the files contained in this archive over the original files in to your phpMyBackup directory. If upgrading from a previous version of phpMyBackup remember to backup your existing phpMyBackup directory before installing this version.



4...Usage...

Via the web

The usage via the web is the same as usual. On the export page, there's an additional box for individual database tables. Please type them with a comma "," in between each tablename. If you leave the tables box blank phpMyBackup will backup the whole database like usual.
  
Via shell

The usage via shell has changed slightly. To backup an entire database use

"php.exe -q export.php databasename" like usual.

To backup individual tables use:

"php.exe -q export.php databasename table1,table2,tableetc".
 With each table separated with a comma  ",".

To restore a database simply use

"php.exe -q import.php databasename".


phpMyBackup will automatically go through the "export" directory and import the newest backup for the corresponding database.



5...Limitations...

  • export.lib - there is no way of turning off the DROP TABLE command when exporting a database this is intentional seeing that this is running via a batch job.


  • shell version of import.php only allows you to import one database at any time.

  • shell version of import.php only allows you to restore the newest backup. This is intentional please see above.





6...Changes...

16/04/2003

  • main.lib - fixed a bug with the ftp delete. Now deletes properly using "$CONF['del_after_days_ftp']" variable. Also allows for Windows "\" in ftp directory names.

26/03/2003

  • export.php - fixed a bug with php 4.1.2 and zlib library in the gzopen command. Now opened with "wb9".

25/03/2003

  • import.php - now takes into account drop table sql command.

  • import.php - updated to allow shell import
    • usage: "import.php databasename"
  • shell version of import.php automatically grabs the latest backup in the "export directory" and imports into the destination database.

  • export.php now allows you to backup individual tables
    • web - by entering table1,table2,tableetc in the tables box
    • shell -- usage: "export.php databasename table1,table2,tableetc"

24/03/2003

  • export.lib - added DROP TABLE IF EXISTS line to sql file for easy importing into phpmyadmin and automatic importing using import.php.
    • Fixes problems when importing backups when database table already exists.



Last updated on June 02, 2003