- if ($errno & error_reporting())
- $messages[] = array($errno, $errstr, $file, $line);
- else if($errno&~E_NOTICE)// log all not displayed messages
- error_log(user_company() . ':' . $_SESSION["wa_current_user"]->loginname.':'
- . basename($file) .":$line: $errstr");
+ if ($errno & error_reporting()) {
+ $messages[] = array($errno, $errstr, $file, $line);
+ }
+ else if($errno&~E_NOTICE) { // log all not displayed messages
+ $user = @$_SESSION["wa_current_user"]->loginname;
+ $context = isset($SysPrefs) && !$SysPrefs->db_ok ? '[before upgrade]' : '';
+ error_log(user_company() . ":$user:". basename($file) .":$line:$context $errstr");
+ }