mirror of
https://github.com/e107inc/e107.git
synced 2025-08-22 14:13:03 +02:00
Updated vendor packages:
hybridauth/hybridauth (v3.8.2 => v3.9.0) ifsnop/mysqldump-php (v2.9 => v2.12) guzzlehttp/psr7 (1.9.0 => 1.9.1) matthiasmullie/minify (1.3.70 => 1.3.71) phpmailer/phpmailer (v6.7.1 => v6.8.0)
This commit is contained in:
@@ -33,6 +33,7 @@ MySQLDump-PHP is the only library that supports:
|
||||
* does insert-ignore, like a REPLACE but ignoring errors if a duplicate key exists.
|
||||
* modifying data from database on-the-fly when dumping, using hooks.
|
||||
* can save directly to google cloud storage over a compressed stream wrapper (GZIPSTREAM).
|
||||
* can restore a dump from a file, when no mysql executable is available.
|
||||
|
||||
## Important
|
||||
|
||||
@@ -172,6 +173,7 @@ $dumpSettingsDefault = array(
|
||||
'compress' => Mysqldump::NONE,
|
||||
'init_commands' => array(),
|
||||
'no-data' => array(),
|
||||
'if-not-exists' => false,
|
||||
'reset-auto-increment' => false,
|
||||
'add-drop-database' => false,
|
||||
'add-drop-table' => false,
|
||||
@@ -187,6 +189,7 @@ $dumpSettingsDefault = array(
|
||||
'insert-ignore' => false,
|
||||
'net_buffer_length' => self::MAXLINESIZE,
|
||||
'no-autocommit' => true,
|
||||
'no-create-db' => false,
|
||||
'no-create-info' => false,
|
||||
'lock-tables' => true,
|
||||
'routines' => false,
|
||||
@@ -220,6 +223,8 @@ $this->_dumpSettings = self::array_replace_recursive($dumpSettingsDefault, $dump
|
||||
- Exclude these tables (array of table names), include all if empty, supports regexps.
|
||||
- **include-views**
|
||||
- Only include these views (array of view names), include all if empty. By default, all views named as the include-tables array are included.
|
||||
- **if-not-exists**
|
||||
- Only create a new table when a table of the same name does not already exist. No error message is thrown if the table already exists.
|
||||
- **compress**
|
||||
- Gzip, Bzip2, None.
|
||||
- Could be specified using the declared consts: IMysqldump\Mysqldump::GZIP, IMysqldump\Mysqldump::BZIP2 or IMysqldump\Mysqldump::NONE
|
||||
@@ -260,6 +265,9 @@ $this->_dumpSettings = self::array_replace_recursive($dumpSettingsDefault, $dump
|
||||
- **no-autocommit**
|
||||
- Option to disable autocommit (faster inserts, no problems with index keys)
|
||||
- https://dev.mysql.com/doc/refman/4.1/en/commit.html
|
||||
- **no-create-db**
|
||||
- Option to disable the dump of create database statements.
|
||||
- https://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_no-create-db
|
||||
- **no-create-info**
|
||||
- https://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_no-create-info
|
||||
- **no-data**
|
||||
|
@@ -43,6 +43,7 @@ class Mysqldump
|
||||
// List of available connection strings.
|
||||
const UTF8 = 'utf8';
|
||||
const UTF8MB4 = 'utf8mb4';
|
||||
const BINARY = 'binary';
|
||||
|
||||
/**
|
||||
* Database username.
|
||||
@@ -75,12 +76,12 @@ class Mysqldump
|
||||
private $procedures = array();
|
||||
private $functions = array();
|
||||
private $events = array();
|
||||
private $dbHandler = null;
|
||||
protected $dbHandler = null;
|
||||
private $dbType = "";
|
||||
private $compressManager;
|
||||
private $typeAdapter;
|
||||
private $dumpSettings = array();
|
||||
private $pdoSettings = array();
|
||||
protected $dumpSettings = array();
|
||||
protected $pdoSettings = array();
|
||||
private $version;
|
||||
private $tableColumnTypes = array();
|
||||
private $transformTableRowCallable;
|
||||
@@ -114,6 +115,48 @@ class Mysqldump
|
||||
private $tableWheres = array();
|
||||
private $tableLimits = array();
|
||||
|
||||
protected $dumpSettingsDefault = array(
|
||||
'include-tables' => array(),
|
||||
'exclude-tables' => array(),
|
||||
'include-views' => array(),
|
||||
'compress' => Mysqldump::NONE,
|
||||
'init_commands' => array(),
|
||||
'no-data' => array(),
|
||||
'if-not-exists' => false,
|
||||
'reset-auto-increment' => false,
|
||||
'add-drop-database' => false,
|
||||
'add-drop-table' => false,
|
||||
'add-drop-trigger' => true,
|
||||
'add-locks' => true,
|
||||
'complete-insert' => false,
|
||||
'databases' => false,
|
||||
'default-character-set' => Mysqldump::UTF8,
|
||||
'disable-keys' => true,
|
||||
'extended-insert' => true,
|
||||
'events' => false,
|
||||
'hex-blob' => true, /* faster than escaped content */
|
||||
'insert-ignore' => false,
|
||||
'net_buffer_length' => self::MAXLINESIZE,
|
||||
'no-autocommit' => true,
|
||||
'no-create-db' => false,
|
||||
'no-create-info' => false,
|
||||
'lock-tables' => true,
|
||||
'routines' => false,
|
||||
'single-transaction' => true,
|
||||
'skip-triggers' => false,
|
||||
'skip-tz-utc' => false,
|
||||
'skip-comments' => false,
|
||||
'skip-dump-date' => false,
|
||||
'skip-definer' => false,
|
||||
'where' => '',
|
||||
/* deprecated */
|
||||
'disable-foreign-keys-check' => true
|
||||
);
|
||||
|
||||
protected $pdoSettingsDefault = array(
|
||||
PDO::ATTR_PERSISTENT => true,
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor of Mysqldump. Note that in the case of an SQLite database
|
||||
@@ -132,46 +175,6 @@ class Mysqldump
|
||||
$dumpSettings = array(),
|
||||
$pdoSettings = array()
|
||||
) {
|
||||
$dumpSettingsDefault = array(
|
||||
'include-tables' => array(),
|
||||
'exclude-tables' => array(),
|
||||
'include-views' => array(),
|
||||
'compress' => Mysqldump::NONE,
|
||||
'init_commands' => array(),
|
||||
'no-data' => array(),
|
||||
'reset-auto-increment' => false,
|
||||
'add-drop-database' => false,
|
||||
'add-drop-table' => false,
|
||||
'add-drop-trigger' => true,
|
||||
'add-locks' => true,
|
||||
'complete-insert' => false,
|
||||
'databases' => false,
|
||||
'default-character-set' => Mysqldump::UTF8,
|
||||
'disable-keys' => true,
|
||||
'extended-insert' => true,
|
||||
'events' => false,
|
||||
'hex-blob' => true, /* faster than escaped content */
|
||||
'insert-ignore' => false,
|
||||
'net_buffer_length' => self::MAXLINESIZE,
|
||||
'no-autocommit' => true,
|
||||
'no-create-info' => false,
|
||||
'lock-tables' => true,
|
||||
'routines' => false,
|
||||
'single-transaction' => true,
|
||||
'skip-triggers' => false,
|
||||
'skip-tz-utc' => false,
|
||||
'skip-comments' => false,
|
||||
'skip-dump-date' => false,
|
||||
'skip-definer' => false,
|
||||
'where' => '',
|
||||
/* deprecated */
|
||||
'disable-foreign-keys-check' => true
|
||||
);
|
||||
|
||||
$pdoSettingsDefault = array(
|
||||
PDO::ATTR_PERSISTENT => true,
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
);
|
||||
|
||||
$this->user = $user;
|
||||
$this->pass = $pass;
|
||||
@@ -179,18 +182,18 @@ class Mysqldump
|
||||
|
||||
// This drops MYSQL dependency, only use the constant if it's defined.
|
||||
if ("mysql" === $this->dbType) {
|
||||
$pdoSettingsDefault[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = false;
|
||||
$this->pdoSettingsDefault[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = false;
|
||||
}
|
||||
|
||||
$this->pdoSettings = self::array_replace_recursive($pdoSettingsDefault, $pdoSettings);
|
||||
$this->dumpSettings = self::array_replace_recursive($dumpSettingsDefault, $dumpSettings);
|
||||
$this->pdoSettings = array_replace_recursive($this->pdoSettingsDefault, $pdoSettings);
|
||||
$this->dumpSettings = array_replace_recursive($this->dumpSettingsDefault, $dumpSettings);
|
||||
$this->dumpSettings['init_commands'][] = "SET NAMES ".$this->dumpSettings['default-character-set'];
|
||||
|
||||
if (false === $this->dumpSettings['skip-tz-utc']) {
|
||||
$this->dumpSettings['init_commands'][] = "SET TIME_ZONE='+00:00'";
|
||||
}
|
||||
|
||||
$diff = array_diff(array_keys($this->dumpSettings), array_keys($dumpSettingsDefault));
|
||||
$diff = array_diff(array_keys($this->dumpSettings), array_keys($this->dumpSettingsDefault));
|
||||
if (count($diff) > 0) {
|
||||
throw new Exception("Unexpected value in dumpSettings: (".implode(",", $diff).")");
|
||||
}
|
||||
@@ -217,31 +220,6 @@ class Mysqldump
|
||||
$this->dbHandler = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom array_replace_recursive to be used if PHP < 5.3
|
||||
* Replaces elements from passed arrays into the first array recursively.
|
||||
*
|
||||
* @param array $array1 The array in which elements are replaced
|
||||
* @param array $array2 The array from which elements will be extracted
|
||||
*
|
||||
* @return array Returns an array, or NULL if an error occurs.
|
||||
*/
|
||||
public static function array_replace_recursive($array1, $array2)
|
||||
{
|
||||
if (function_exists('array_replace_recursive')) {
|
||||
return array_replace_recursive($array1, $array2);
|
||||
}
|
||||
|
||||
foreach ($array2 as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$array1[$key] = self::array_replace_recursive($array1[$key], $value);
|
||||
} else {
|
||||
$array1[$key] = $value;
|
||||
}
|
||||
}
|
||||
return $array1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keyed by table name, with the value as the conditions:
|
||||
* e.g. 'users' => 'date_registered > NOW() - INTERVAL 6 MONTH AND deleted=0'
|
||||
@@ -287,7 +265,7 @@ class Mysqldump
|
||||
*/
|
||||
public function getTableLimit($tableName)
|
||||
{
|
||||
if (empty($this->tableLimits[$tableName])) {
|
||||
if (!isset($this->tableLimits[$tableName])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -299,6 +277,46 @@ class Mysqldump
|
||||
return $limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import supplied SQL file
|
||||
* @param string $path Absolute path to imported *.sql file
|
||||
*/
|
||||
public function restore($path)
|
||||
{
|
||||
if(!$path || !is_file($path)){
|
||||
throw new Exception("File {$path} does not exist.");
|
||||
}
|
||||
|
||||
$handle = fopen($path , 'rb');
|
||||
|
||||
if(!$handle){
|
||||
throw new Exception("Failed reading file {$path}. Check access permissions.");
|
||||
}
|
||||
|
||||
if(!$this->dbHandler){
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
$buffer = '';
|
||||
while ( !feof($handle) ) {
|
||||
$line = trim(fgets($handle));
|
||||
|
||||
if (substr($line, 0, 2) == '--' || !$line) {
|
||||
continue; // skip comments
|
||||
}
|
||||
|
||||
$buffer .= $line;
|
||||
|
||||
// if it has a semicolon at the end, it's the end of the query
|
||||
if (';' == substr(rtrim($line), -1, 1)) {
|
||||
$this->dbHandler->exec($buffer);
|
||||
$buffer = '';
|
||||
}
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse DSN string and extract dbname value
|
||||
* Several examples of a DSN string
|
||||
@@ -350,7 +368,7 @@ class Mysqldump
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function connect()
|
||||
protected function connect()
|
||||
{
|
||||
// Connecting with PDO.
|
||||
try {
|
||||
@@ -415,6 +433,12 @@ class Mysqldump
|
||||
// Write some basic info to output file
|
||||
$this->compressManager->write($this->getDumpFileHeader());
|
||||
|
||||
// initiate a transaction at global level to create a consistent snapshot
|
||||
if ($this->dumpSettings['single-transaction']) {
|
||||
$this->dbHandler->exec($this->typeAdapter->setup_transaction());
|
||||
$this->dbHandler->exec($this->typeAdapter->start_transaction());
|
||||
}
|
||||
|
||||
// Store server settings and use sanner defaults to dump
|
||||
$this->compressManager->write(
|
||||
$this->typeAdapter->backup_parameters()
|
||||
@@ -466,6 +490,12 @@ class Mysqldump
|
||||
$this->compressManager->write(
|
||||
$this->typeAdapter->restore_parameters()
|
||||
);
|
||||
|
||||
// end transaction
|
||||
if ($this->dumpSettings['single-transaction']) {
|
||||
$this->dbHandler->exec($this->typeAdapter->commit_transaction());
|
||||
}
|
||||
|
||||
// Write some stats to output file.
|
||||
$this->compressManager->write($this->getDumpFileFooter());
|
||||
// Close output file.
|
||||
@@ -676,6 +706,8 @@ class Mysqldump
|
||||
*/
|
||||
private function exportTables()
|
||||
{
|
||||
|
||||
|
||||
// Exporting tables one by one
|
||||
foreach ($this->tables as $table) {
|
||||
if ($this->matches($table, $this->dumpSettings['exclude-tables'])) {
|
||||
@@ -845,7 +877,7 @@ class Mysqldump
|
||||
{
|
||||
if (!$this->dumpSettings['skip-comments']) {
|
||||
$ret = "--".PHP_EOL.
|
||||
"-- Stand-In structure for view `${viewName}`".PHP_EOL.
|
||||
"-- Stand-In structure for view `{$viewName}`".PHP_EOL.
|
||||
"--".PHP_EOL.PHP_EOL;
|
||||
$this->compressManager->write($ret);
|
||||
}
|
||||
@@ -877,7 +909,7 @@ class Mysqldump
|
||||
{
|
||||
$ret = array();
|
||||
foreach ($this->tableColumnTypes[$viewName] as $k => $v) {
|
||||
$ret[] = "`${k}` ${v['type_sql']}";
|
||||
$ret[] = "`{$k}` {$v['type_sql']}";
|
||||
}
|
||||
$ret = implode(PHP_EOL.",", $ret);
|
||||
|
||||
@@ -898,7 +930,7 @@ class Mysqldump
|
||||
{
|
||||
if (!$this->dumpSettings['skip-comments']) {
|
||||
$ret = "--".PHP_EOL.
|
||||
"-- View structure for view `${viewName}`".PHP_EOL.
|
||||
"-- View structure for view `{$viewName}`".PHP_EOL.
|
||||
"--".PHP_EOL.PHP_EOL;
|
||||
$this->compressManager->write($ret);
|
||||
}
|
||||
@@ -1052,7 +1084,7 @@ class Mysqldump
|
||||
return "NULL";
|
||||
} elseif ($this->dumpSettings['hex-blob'] && $colType['is_blob']) {
|
||||
if ($colType['type'] == 'bit' || !empty($colValue)) {
|
||||
return "0x${colValue}";
|
||||
return "0x{$colValue}";
|
||||
} else {
|
||||
return "''";
|
||||
}
|
||||
@@ -1133,7 +1165,7 @@ class Mysqldump
|
||||
|
||||
$limit = $this->getTableLimit($tableName);
|
||||
|
||||
if ($limit) {
|
||||
if ($limit !== false) {
|
||||
$stmt .= " LIMIT {$limit}";
|
||||
}
|
||||
|
||||
@@ -1198,11 +1230,6 @@ class Mysqldump
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->dumpSettings['single-transaction']) {
|
||||
$this->dbHandler->exec($this->typeAdapter->setup_transaction());
|
||||
$this->dbHandler->exec($this->typeAdapter->start_transaction());
|
||||
}
|
||||
|
||||
if ($this->dumpSettings['lock-tables'] && !$this->dumpSettings['single-transaction']) {
|
||||
$this->typeAdapter->lock_table($tableName);
|
||||
}
|
||||
@@ -1251,10 +1278,6 @@ class Mysqldump
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->dumpSettings['single-transaction']) {
|
||||
$this->dbHandler->exec($this->typeAdapter->commit_transaction());
|
||||
}
|
||||
|
||||
if ($this->dumpSettings['lock-tables'] && !$this->dumpSettings['single-transaction']) {
|
||||
$this->typeAdapter->unlock_table($tableName);
|
||||
}
|
||||
@@ -1289,15 +1312,17 @@ class Mysqldump
|
||||
{
|
||||
$colStmt = array();
|
||||
foreach ($this->tableColumnTypes[$tableName] as $colName => $colType) {
|
||||
if ($colType['type'] == 'bit' && $this->dumpSettings['hex-blob']) {
|
||||
$colStmt[] = "LPAD(HEX(`${colName}`),2,'0') AS `${colName}`";
|
||||
} elseif ($colType['is_blob'] && $this->dumpSettings['hex-blob']) {
|
||||
$colStmt[] = "HEX(`${colName}`) AS `${colName}`";
|
||||
} elseif ($colType['is_virtual']) {
|
||||
if ($colType['is_virtual']) {
|
||||
$this->dumpSettings['complete-insert'] = true;
|
||||
continue;
|
||||
} elseif ($colType['type'] == 'bit' && $this->dumpSettings['hex-blob']) {
|
||||
$colStmt[] = "LPAD(HEX(`{$colName}`),2,'0') AS `{$colName}`";
|
||||
} elseif ($colType['type'] == 'double' && PHP_VERSION_ID > 80100) {
|
||||
$colStmt[] = sprintf("CONCAT(`%s`) AS `%s`", $colName, $colName);
|
||||
} elseif ($colType['is_blob'] && $this->dumpSettings['hex-blob']) {
|
||||
$colStmt[] = "HEX(`{$colName}`) AS `{$colName}`";
|
||||
} else {
|
||||
$colStmt[] = "`${colName}`";
|
||||
$colStmt[] = "`{$colName}`";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1319,7 +1344,7 @@ class Mysqldump
|
||||
$this->dumpSettings['complete-insert'] = true;
|
||||
continue;
|
||||
} else {
|
||||
$colNames[] = "`${colName}`";
|
||||
$colNames[] = "`{$colName}`";
|
||||
}
|
||||
}
|
||||
return $colNames;
|
||||
@@ -1665,7 +1690,7 @@ abstract class TypeAdapterFactory
|
||||
|
||||
$args = func_get_args();
|
||||
|
||||
return "pragma table_info(${args[0]})";
|
||||
return "pragma table_info({$args[0]})";
|
||||
}
|
||||
|
||||
public function show_procedures()
|
||||
@@ -1835,6 +1860,10 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
|
||||
public function databases()
|
||||
{
|
||||
if ($this->dumpSettings['no-create-db']) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
$databaseName = $args[0];
|
||||
@@ -1848,10 +1877,10 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$resultSet->closeCursor();
|
||||
$ret = "";
|
||||
|
||||
$ret .= "CREATE DATABASE /*!32312 IF NOT EXISTS*/ `${databaseName}`".
|
||||
" /*!40100 DEFAULT CHARACTER SET ${characterSet} ".
|
||||
" COLLATE ${collationDb} */;".PHP_EOL.PHP_EOL.
|
||||
"USE `${databaseName}`;".PHP_EOL.PHP_EOL;
|
||||
$ret .= "CREATE DATABASE /*!32312 IF NOT EXISTS*/ `{$databaseName}`".
|
||||
" /*!40100 DEFAULT CHARACTER SET {$characterSet} ".
|
||||
" COLLATE {$collationDb} */;".PHP_EOL.PHP_EOL.
|
||||
"USE `{$databaseName}`;".PHP_EOL.PHP_EOL;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
@@ -1899,6 +1928,10 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$createTable = preg_replace($match, $replace, $createTable);
|
||||
}
|
||||
|
||||
if ($this->dumpSettings['if-not-exists'] ) {
|
||||
$createTable = preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $createTable);
|
||||
}
|
||||
|
||||
$ret = "/*!40101 SET @saved_cs_client = @@character_set_client */;".PHP_EOL.
|
||||
"/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL.
|
||||
$createTable.";".PHP_EOL.
|
||||
@@ -1920,7 +1953,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
|
||||
if ($viewStmtReplaced = preg_replace(
|
||||
'/^(CREATE(?:\s+ALGORITHM=(?:UNDEFINED|MERGE|TEMPTABLE))?)\s+('
|
||||
.self::DEFINER_RE.'(?:\s+SQL SECURITY DEFINER|INVOKER)?)?\s+(VIEW .+)$/',
|
||||
.self::DEFINER_RE.'(?:\s+SQL SECURITY (?:DEFINER|INVOKER))?)?\s+(VIEW .+)$/',
|
||||
'/*!50001 \1 */'.PHP_EOL.$definerStr.'/*!50001 \3 */',
|
||||
$viewStmt,
|
||||
1
|
||||
@@ -2088,7 +2121,8 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$args = func_get_args();
|
||||
return "SELECT TABLE_NAME AS tbl_name ".
|
||||
"FROM INFORMATION_SCHEMA.TABLES ".
|
||||
"WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='${args[0]}'";
|
||||
"WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='{$args[0]}' ".
|
||||
"ORDER BY TABLE_NAME";
|
||||
}
|
||||
|
||||
public function show_views()
|
||||
@@ -2097,21 +2131,22 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$args = func_get_args();
|
||||
return "SELECT TABLE_NAME AS tbl_name ".
|
||||
"FROM INFORMATION_SCHEMA.TABLES ".
|
||||
"WHERE TABLE_TYPE='VIEW' AND TABLE_SCHEMA='${args[0]}'";
|
||||
"WHERE TABLE_TYPE='VIEW' AND TABLE_SCHEMA='{$args[0]}' ".
|
||||
"ORDER BY TABLE_NAME";
|
||||
}
|
||||
|
||||
public function show_triggers()
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "SHOW TRIGGERS FROM `${args[0]}`;";
|
||||
return "SHOW TRIGGERS FROM `{$args[0]}`;";
|
||||
}
|
||||
|
||||
public function show_columns()
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "SHOW COLUMNS FROM `${args[0]}`;";
|
||||
return "SHOW COLUMNS FROM `{$args[0]}`;";
|
||||
}
|
||||
|
||||
public function show_procedures()
|
||||
@@ -2120,7 +2155,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$args = func_get_args();
|
||||
return "SELECT SPECIFIC_NAME AS procedure_name ".
|
||||
"FROM INFORMATION_SCHEMA.ROUTINES ".
|
||||
"WHERE ROUTINE_TYPE='PROCEDURE' AND ROUTINE_SCHEMA='${args[0]}'";
|
||||
"WHERE ROUTINE_TYPE='PROCEDURE' AND ROUTINE_SCHEMA='{$args[0]}'";
|
||||
}
|
||||
|
||||
public function show_functions()
|
||||
@@ -2129,7 +2164,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$args = func_get_args();
|
||||
return "SELECT SPECIFIC_NAME AS function_name ".
|
||||
"FROM INFORMATION_SCHEMA.ROUTINES ".
|
||||
"WHERE ROUTINE_TYPE='FUNCTION' AND ROUTINE_SCHEMA='${args[0]}'";
|
||||
"WHERE ROUTINE_TYPE='FUNCTION' AND ROUTINE_SCHEMA='{$args[0]}'";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2144,7 +2179,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$args = func_get_args();
|
||||
return "SELECT EVENT_NAME AS event_name ".
|
||||
"FROM INFORMATION_SCHEMA.EVENTS ".
|
||||
"WHERE EVENT_SCHEMA='${args[0]}'";
|
||||
"WHERE EVENT_SCHEMA='{$args[0]}'";
|
||||
}
|
||||
|
||||
public function setup_transaction()
|
||||
@@ -2168,7 +2203,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return $this->dbHandler->exec("LOCK TABLES `${args[0]}` READ LOCAL");
|
||||
return $this->dbHandler->exec("LOCK TABLES `{$args[0]}` READ LOCAL");
|
||||
}
|
||||
|
||||
public function unlock_table()
|
||||
@@ -2180,7 +2215,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "LOCK TABLES `${args[0]}` WRITE;".PHP_EOL;
|
||||
return "LOCK TABLES `{$args[0]}` WRITE;".PHP_EOL;
|
||||
}
|
||||
|
||||
public function end_add_lock_table()
|
||||
@@ -2192,7 +2227,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "/*!40000 ALTER TABLE `${args[0]}` DISABLE KEYS */;".
|
||||
return "/*!40000 ALTER TABLE `{$args[0]}` DISABLE KEYS */;".
|
||||
PHP_EOL;
|
||||
}
|
||||
|
||||
@@ -2200,7 +2235,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "/*!40000 ALTER TABLE `${args[0]}` ENABLE KEYS */;".
|
||||
return "/*!40000 ALTER TABLE `{$args[0]}` ENABLE KEYS */;".
|
||||
PHP_EOL;
|
||||
}
|
||||
|
||||
@@ -2218,7 +2253,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "/*!40000 DROP DATABASE IF EXISTS `${args[0]}`*/;".
|
||||
return "/*!40000 DROP DATABASE IF EXISTS `{$args[0]}`*/;".
|
||||
PHP_EOL.PHP_EOL;
|
||||
}
|
||||
|
||||
@@ -2226,22 +2261,22 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "DROP TRIGGER IF EXISTS `${args[0]}`;".PHP_EOL;
|
||||
return "DROP TRIGGER IF EXISTS `{$args[0]}`;".PHP_EOL;
|
||||
}
|
||||
|
||||
public function drop_table()
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "DROP TABLE IF EXISTS `${args[0]}`;".PHP_EOL;
|
||||
return "DROP TABLE IF EXISTS `{$args[0]}`;".PHP_EOL;
|
||||
}
|
||||
|
||||
public function drop_view()
|
||||
{
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "DROP TABLE IF EXISTS `${args[0]}`;".PHP_EOL.
|
||||
"/*!50001 DROP VIEW IF EXISTS `${args[0]}`*/;".PHP_EOL;
|
||||
return "DROP TABLE IF EXISTS `{$args[0]}`;".PHP_EOL.
|
||||
"/*!50001 DROP VIEW IF EXISTS `{$args[0]}`*/;".PHP_EOL;
|
||||
}
|
||||
|
||||
public function getDatabaseHeader()
|
||||
@@ -2249,7 +2284,7 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
|
||||
$args = func_get_args();
|
||||
return "--".PHP_EOL.
|
||||
"-- Current Database: `${args[0]}`".PHP_EOL.
|
||||
"-- Current Database: `{$args[0]}`".PHP_EOL.
|
||||
"--".PHP_EOL.PHP_EOL;
|
||||
}
|
||||
|
||||
@@ -2294,6 +2329,10 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
"/*!40103 SET TIME_ZONE='+00:00' */;".PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->dumpSettings['no-autocommit']) {
|
||||
$ret .= "/*!40101 SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT */;".PHP_EOL;
|
||||
}
|
||||
|
||||
$ret .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;".PHP_EOL.
|
||||
"/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;".PHP_EOL.
|
||||
"/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;".PHP_EOL.
|
||||
@@ -2310,6 +2349,10 @@ class TypeAdapterMysql extends TypeAdapterFactory
|
||||
$ret .= "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;".PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->dumpSettings['no-autocommit']) {
|
||||
$ret .= "/*!40101 SET AUTOCOMMIT=@OLD_AUTOCOMMIT */;".PHP_EOL;
|
||||
}
|
||||
|
||||
$ret .= "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;".PHP_EOL.
|
||||
"/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;".PHP_EOL.
|
||||
"/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;".PHP_EOL.
|
||||
|
Reference in New Issue
Block a user