From 78dfda5da73f5a97d108703e34b70b2ca957fe7a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 12 Jul 2016 16:55:50 +0200 Subject: [dozmod] Minor api cleanup --- modules-available/dozmod/api.inc.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/modules-available/dozmod/api.inc.php b/modules-available/dozmod/api.inc.php index 1adcc429..17ead3c1 100644 --- a/modules-available/dozmod/api.inc.php +++ b/modules-available/dozmod/api.inc.php @@ -28,7 +28,7 @@ function cache_hash($obj) function cache_key_to_filename($key) { - return "/tmp/bwlp-slxadmin-cache-$key"; // TODO: hash + return "/tmp/bwlp-slxadmin-cache-$key"; } function cache_put($key, $value) @@ -52,7 +52,6 @@ function cache_has($key) } } - function cache_get($key) { $filename = cache_key_to_filename($key); @@ -81,18 +80,6 @@ function cache_get_passthru($key) **/ -/** - * Get list of active lectures for given locations. - * - * @return string the raw xml data. - */ -function _getLecturesForLocations($locationIds, $examMode) -{ - $ids = implode('%20', $locationIds); - $url = LIST_URL . "?locations=$ids" . ($examMode ? '&exams' : ''); - return Download::asString($url, 60, $code); -} - /** * Takes raw lecture list xml, returns array of uuids. * @@ -135,7 +122,11 @@ function getListForLocations($locationIds, $raw) return unserialize(cache_get($key)); } // Not in cache - $value = _getLecturesForLocations($locationIds, $examMode); + $url = LIST_URL . "?locations=" . implode('%20', $locationIds); + if ($examMode) { + $url .= '&exams'; + } + $value = Download::asString($url, 60, $code); if ($value === false) return false; cache_put($rawKey, $value); -- cgit v1.2.3-55-g7522