We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent db29334 commit 6fce356Copy full SHA for 6fce356
1 file changed
src/libs/Xiidea/Installer/Services/DataBase.php
@@ -104,10 +104,24 @@ public function parseMysqlDump($url)
104
continue;
105
}
106
107
- mysql_query($query) or $error[] = mysql_error();
+ mysql_query($this->addTablePrefix($query)) or $error[] = mysql_error();
108
109
110
111
+ private function addTablePrefix($query)
112
+ {
113
+ if (empty(self::$config['dbprefix'])) {
114
+ return $query;
115
+ }
116
+
117
+ return preg_replace(
118
+ '/(insert into|for the table|for table|CREATE TABLE|DROP TABLE IF EXISTS) `([\w]+)`/',
119
+ '${1} `' . self::$config['dbprefix'] .'${2}`',
120
+ $query
121
+ );
122
123
124
125
function splitQueryText($query)
126
{
127
// the regex needs a trailing semicolon
0 commit comments