X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fsql-functions.php;h=ce598ad39aa0b5011c40b3ece36c3563ef06fe14;hb=8848f4a3fd7b32a1bbd9139766171701b94b2f42;hp=5686a79ff5a863403646bf92f7521b268b27410b;hpb=6b1e55213d76a67e9aa3d9f1e4dcb55e0bbf12ee;p=mailer.git diff --git a/inc/sql-functions.php b/inc/sql-functions.php index 5686a79ff5..ce598ad39a 100644 --- a/inc/sql-functions.php +++ b/inc/sql-functions.php @@ -10,13 +10,8 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : SQL-Funktionen fuer Queries * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * Copyright (c) 2009 - 2015 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -782,5 +777,41 @@ WHERE ); } +// Log SQL errors to debug.log in installation phase or call reportBug() +function logSqlError ($file, $line, $message) { + // Remember plain error in last_sql_error + setSqlError($file, $line, $message); + + // Is login set? + if (!empty($GLOBALS['mysql']['login'])) { + // Secure login name in message + $message = str_replace($GLOBALS['mysql']['login'], '***', $message); + } // END - if + + // Is database password set? + if (!empty($GLOBALS['mysql']['password'])) { + // Secure password in message + $message = str_replace($GLOBALS['mysql']['password'], '***', $message); + } // END - if + + // Is database name set? + if (!empty($GLOBALS['mysql']['dbase'])) { + // Secure database name in message + $message = str_replace($GLOBALS['mysql']['dbase'], '***', $message); + } // END - if + + // Is there installation phase? + if (isInstaller()) { + /* + * In installation phase, we don't want SQL errors abort e.g. connection + * tests, so just log it away. + */ + logDebugMessage($file, $line, $message); + } else { + // Regular mode, then call reportBug() + reportBug($file, $line, $message); + } +} + // [EOF] ?>