Perform a database export/dump
Usage
// basic usage
$string = $backup->backup();
// usage with all arguments
$string = $backup->backup(array $options = []);
Arguments
| Name | Type(s) | Description |
|---|
$options (optional) | array | Options to modify default behavior: filename (string): filename for backup: default is to make a dated filename, but this can also be used (basename only, no path)description (string): optional description of this backuptables (array): if specified, export will only include these tablesuser (string): username to associate with the backup file (string), optionalexcludeTables (array): exclude creating or inserting into these tablesexcludeCreateTables (array): exclude creating these tables, but still export dataexcludeExportTables (array): exclude exporting data, but still create tableswhereSQL (array): SQL conditions for export of individual tables [table => [SQL conditions]]. The table portion (index) may also be a full PCRE regexp, must start with / to be recognized as regex.maxSeconds (int): max number of seconds allowed for execution Default:1200allowDrop (bool): use DROP TABLES statements before CREATE TABLE statements? Default:trueallowUpdate (bool): use UPDATE ON DUPLICATE KEY so that INSERT statements can UPDATE when rows already present (all tables). Default:falseallowUpdateTables (array): table names that will use UPDATE ON DUPLICATE KEY (does NOT require allowUpdate=true)findReplace (array): find and replace in row data during backup. Example: ['databass' => 'database']findReplaceCreateTable (array): find and replace in create table statements
Example: ['DEFAULT CHARSET=latin1;' => 'DEFAULT CHARSET=utf8;']extraSQL (array): additional SQL queries to append at the bottom. Example: ['UPDATE pages SET created=NOW()']
|
Return value
stringFull path and filename of database export file, or false on failure.
Exceptions
Method can throw exceptions on error:
See Also
$backup methods and properties
API reference based on ProcessWire core version 3.0.257