summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/inc/locationinfo.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-07 13:29:48 +0100
committerSimon Rettberg2019-03-07 13:29:48 +0100
commit35078669abfbe296b578b3f131a30dcb38ed99f5 (patch)
tree2b1ee1010ce9605007bf0cc95e80ed9767843212 /modules-available/locationinfo/inc/locationinfo.inc.php
parent[locationinfo] Fix form<->button relation (delete, check, etc.) (diff)
downloadslx-admin-35078669abfbe296b578b3f131a30dcb38ed99f5.tar.gz
slx-admin-35078669abfbe296b578b3f131a30dcb38ed99f5.tar.xz
slx-admin-35078669abfbe296b578b3f131a30dcb38ed99f5.zip
[locationinfo] Add error log for backends
Diffstat (limited to 'modules-available/locationinfo/inc/locationinfo.inc.php')
-rw-r--r--modules-available/locationinfo/inc/locationinfo.inc.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php
index 377e960b..6cc71b3e 100644
--- a/modules-available/locationinfo/inc/locationinfo.inc.php
+++ b/modules-available/locationinfo/inc/locationinfo.inc.php
@@ -46,10 +46,25 @@ class LocationInfo
* Set current error message of given server. Pass null or false to clear.
*
* @param int $serverId id of server
- * @param string $message error message to set, null or false clears error.
+ * @param string|array $message error message to set, array of error message struct, null or false clears error.
*/
public static function setServerError($serverId, $message)
{
+ if (is_array($message)) {
+ $fatal = false;
+ foreach ($message as $m) {
+ if ($m['fatal']) {
+ $fatal = $m['message'];
+ }
+ Database::exec('INSERT INTO locationinfo_backendlog (serverid, dateline, message)
+ VALUES (:sid, :dateline, :message)', [
+ 'sid' => $serverId,
+ 'dateline' => $m['time'],
+ 'message' => ($m['fatal'] ? '[F]' : '[W]') . $m['message'],
+ ]);
+ }
+ $message = $fatal;
+ }
if ($message === false || $message === null) {
Database::exec("UPDATE `locationinfo_coursebackend` SET error = NULL
WHERE serverid = :id", array('id' => $serverId));