PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Luis Arturo Aguilar Mendoza   MySQL DB Backup   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Readme
Class: MySQL DB Backup
Generate backup files of large MySQL databases
Author: By
Last change: Updated info
Date: 14 years ago
Size: 2,947 bytes
 

Contents

Class file image Download
MySQL DB export class, version 1.1.1 WHAT'S NEW? - The class now is PHP5 compatible version 1.0.1 WHAT'S NEW? - The class now can make backups from big databases (+16M in SQL code) when it creates a backup file or saves the backup file in users computer. - Added the task MSX_APPEND HOW TO USE 1. Create the instance of MySQL_Export class. 2. Define necessary properties. 3. Call Execute() method to create backup. require_once 'mysql_export.class.php'; $backup_obj = new MySQL_DB_Backup(); $backup_obj->server = 'localhost'; $backup_obj->username = 'username'; $backup_obj->password = 'password'; $backup_obj->database = 'dbname'; $backup_obj->tables = array(); $backup_obj->create_tables = true; $backup_obj->drop_tables = true; $backup_obj->struct_only = false; $backup_obj->locks = true; $backup_obj->comments = true; $backup_obj->fname_format = 'd_m_y__H_i_s'; $backup_obj->null_values = array( '0000-00-00', '00:00:00', '0000-00-00 00:00:00'); if (!$backup_obj->Execute(MSX_DOWNLOAD, '', true)) { die($backup_obj->error); } PUBLIC PROPERTIES var $server = 'localhost'; The name of MySQL server. var $port = 3306; The port of MySQl server. var $username = 'root'; Database username. var $password = ''; Database password. var $database = ''; Name of the database. var $link_id = -1; MySQL link identifier of the current connection. You can set this if you want to connect the MySQL server by your own. var $connected = false; Set true if the connection is already established before calling Execute(). var $tables = array(); Tables you want to backup. All tables in the database will be backed up if this array is empty. var $create_tables = true; Backup the structure of tables if true. var $drop_tables = true; Add DROP TABLE IF EXISTS queries before CREATE TABLE in backup file. var $struct_only = false; Only structure of the tables will be backed up if true. var $locks = true; Add LOCK TABLES and UNLOCK TABLES queries before and after each INSERT queries block. var $comments = true; Include comments in backup file if true. var $backup_dir = ''; Directory on the server where the backup file will be placed. Used if task parameter equals to MSX_SAVE or MSX_DOWNLOAD in Execute() method. var $fname_format = 'd_m_y__H_i_s'; Default file name format. var $error = ''; Error message. var $null_values = array( '0000-00-00', '00:00:00', '0000-00-00 00:00:00'); Values which must be interpreted as NULL PUBLIC METHODS function Execute($task = MSX_STRING, $fname = '', $compress = false) $task - operation to perform: MSX_STRING - return SQL commands as a string; MSX_SAVE - create the backup file on the server; MSX_DOWNLOAD - save backup file in the user's computer; MSX_APPEND - append backup in the file on the server. $fname - optional name of backup file. $compress - use GZip compression?