From e856ff49e44eec43a84123810e9672f4c92dcaa0 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 2 Oct 2006 02:38:30 +0000 Subject: --- user_guide/database/utilities.html | 50 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'user_guide') diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html index cbd8be784..cf42aaee5 100644 --- a/user_guide/database/utilities.html +++ b/user_guide/database/utilities.html @@ -240,34 +240,44 @@ If you need to write the file use the File

$this->dbutil->backup()

-

Permits you to backup your full database or individual tables. The backup data can be compressed in either Zip or Gzip format, -and it can be downloaded to your desktop, archived to your -server, returned as a string, or simply displayed.

+

Permits you to backup your full database or individual tables. The backup data can be compressed in either Zip or Gzip format.

Note: Due to the limited execution time and memory available to PHP, backing up very large databases may not be possible. If your database is very large you might need to backup directly from your SQL server via the command line, or have your server admin do it for you if you do not have root privileges.

-

Usage example:

+

Usage Example

-$this->dbutil->backup();

-// When no parameters are passed the full database is backed up and downloaded to your desktop as a Gzip file. + +// Load the DB utility class
+$this->load->dbutil();

+ +// Backup your entire database
+$backup =& $this->dbutil->backup(); + +

+// Load the file helper and write the file to your server
+$this->load->helper('file');
+write_file('/path/to/mybackup.gz', $backup); + +

+// Load the download helper and send the file to your desktop
+$this->load->helper('download');
+force_download('mybackup.gz', $backup);

Setting Backup Preferences

-

Preferences are set by submitting an array of values to the first parameter of the backup function. Example:

+

Backup preferences are set by submitting an array of values to the first parameter of the backup function. Example:

$prefs = array(
                'tables'      => array('table1', 'table2'),  // Array of tables to backup.
-                'ignore'      => array(),             // List of tables to omit from the backup
-                'format'      => 'txt',               // gzip, zip, txt
-                'action'      => 'archive',           // download, archive, echo, return
-                'filename'    => 'sql_archive',       // File name - no file extension!
-                'filepath'    => '/path/to/folder/',  // Path needed only when archiving to your server
-                'add_drop'    => TRUE,                // Whether to add DROP TABLE statements to backup file
-                'add_insert'  => TRUE,                // Whether to add INSERT data to backup file
-                'newline'     => "\n"                 // Newline character used in backup file
+                'ignore'      => array(),           // List of tables to omit from the backup
+                'format'      => 'txt',             // gzip, zip, txt
+                'filename'    => 'mybackup.sql',    // File name - NEEDED ONLY WITH ZIP FILES
+                'add_drop'    => TRUE,              // Whether to add DROP TABLE statements to backup file
+                'add_insert'  => TRUE,              // Whether to add INSERT data to backup file
+                'newline'     => "\n"               // Newline character used in backup file
              );

$this->dbutil->backup($prefs); @@ -283,17 +293,13 @@ $this->dbutil->backup($prefs); Options Description -tablesempty arrayNoneAn array of tables you would liked backed up. If left blank all tables will be exported. +tablesempty arrayNoneAn array of tables you want backed up. If left blank all tables will be exported. -ignoreempty arrayNoneAn array of tables you would liked the backup routine to ignore. +ignoreempty arrayNoneAn array of tables you want the backup routine to ignore. formatgzipgzip, zip, txtThe file format of the export file. -actiondownloaddownload, archive, echo, returnWhat action you would like applied to the data. "download" sends it to your desktop, "archive" writes the file to your server, "return" returns the backup as a string, and "echo" simply echos it out for viewing. - -filenamethe current date/timeNoneThe name of the export file. DO NOT include the file extension. - -filepathempty stringNoneThe path to the directory where you would like the archived file written to. Used ONLY when the "archive" action is set. +filenamethe current date/timeNoneThe name of the backed-up file. The name is needed only if you are using zip compression. add_dropTRUETRUE/FALSEWhether to include DROP TABLE statements in your SQL export file. -- cgit v1.2.3-24-g4f1b