Skip to content
Snippets Groups Projects
Commit 34b0cfd1 authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge pull request #1773 from protich/issue/dberror-during-upgrade


upgrader: Log SQL errors

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents d8fca6b4 ad1f47db
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,8 @@ Class SetupWizard {
load SQL schema - assumes MySQL && existing connection
*/
function load_sql($schema, $prefix, $abort=true, $debug=false) {
global $ost;
# Strip comments and remarks
$schema=preg_replace('%^\s*(#|--).*$%m', '', $schema);
# Replace table prefix
......@@ -62,8 +64,10 @@ Class SetupWizard {
foreach($statements as $k=>$sql) {
if(db_query($sql, false)) continue;
$error = "[$sql] ".db_error();
if($abort)
return $this->abort($error, $debug);
if ($abort)
return $this->abort($error, $debug);
elseif ($debug && $ost)
$ost->logDBError('DB Error #'.db_errno(), $error, false);
}
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment