diff options
author | Simon Rettberg | 2017-04-18 15:53:07 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-18 15:53:07 +0200 |
commit | 865db83c68f919d2ecf6fa5c0fed37f70541ba15 (patch) | |
tree | c1f10a2d4a8a30edf8881d7b2ac7f093a1f3795e /modules-available/locationinfo/inc | |
parent | [locations] Make Location::getTree() public (diff) | |
download | slx-admin-865db83c68f919d2ecf6fa5c0fed37f70541ba15.tar.gz slx-admin-865db83c68f919d2ecf6fa5c0fed37f70541ba15.tar.xz slx-admin-865db83c68f919d2ecf6fa5c0fed37f70541ba15.zip |
[locationinfo] Use Location helper for getRoomTree, check backend validity in getCalendar
Diffstat (limited to 'modules-available/locationinfo/inc')
-rw-r--r-- | modules-available/locationinfo/inc/locationinfo.inc.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php index 9bd5ff5b..7617d143 100644 --- a/modules-available/locationinfo/inc/locationinfo.inc.php +++ b/modules-available/locationinfo/inc/locationinfo.inc.php @@ -36,4 +36,28 @@ class LocationInfo return -1; } + /** + * 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. + */ + public static function setServerError($serverId, $message) + { + if ($message === false || $message === null) { + Database::exec("UPDATE `setting_location_info` SET error = NULL + WHERE serverid = :id", array('id' => $serverId)); + } else { + if (empty($message)) { + $message = '<empty error message>'; + } + $error = json_encode(array( + 'timestamp' => time(), + 'error' => (string)$message + )); + Database::exec("UPDATE `setting_location_info` SET error = :error + WHERE serverid = :id", array('id' => $serverId, 'error' => $error)); + } + } + } |