// installation number value 'n' (WCF_N) must be reflected in the executed sql queries
$sql = StringUtil::replace('wcf1_', 'wcf'.WCF_N.'_', $sql);
+ $GLOBALS['__db'] = array(
+ 'parse' => 0,
+ 'modify' => 0,
+ 'insert' => 0
+ );
+
// execute sql queries
$parser = new SQLParser($sql);
$parser->execute();
preg_match_all("~CREATE\s+TABLE\s+(\w+)~i", $sql, $matches);
if (!empty($matches[1])) {
+ $s2 = microtime(true);
$sql = "INSERT INTO wcf".WCF_N."_package_installation_sql_log
(sqlTable)
VALUES (?)";
foreach ($matches[1] as $tableName) {
$statement->execute(array($tableName));
}
+ $GLOBALS['__db']['insert'] = round(microtime(true) - $s2, 3);
}
+ file_put_contents(WCF_DIR.'__sqlPerformance.log', print_r($GLOBALS['__db']));
+
/*
* Manually install PIPPackageInstallationPlugin since install.sql content is not escaped resulting
* in different behaviour in MySQL and MSSQL. You SHOULD NOT move this into install.sql!
if (preg_match('~^(ALTER\s+TABLE|CREATE\s+INDEX|CREATE\s+TABLE|DROP\s+INDEX|DROP\s+TABLE|INSERT|UPDATE|DELETE)~i', $query, $match)) {
$statement = strtoupper(preg_replace('~\s+~', ' ', $match[0]));
+ $GLOBALS['__db']['parse']++;
+
+ $s = microtime(true);
$this->executeStatement($statement, $query);
+ $GLOBALS['__db']['modify'] += round(microtime(true) - $s, 3);
}
}
}