/** * @brief Get the latest system version which is available (in the internet or in the directory "/updates/") * * @param string $type 'stable' or 'unstable' * * @retval Version the latest available system version * * @throws Exception if there was an error * * @todo Search also in the local direcotry "/updates/" for updates. * This is needed for manual updates (maybe the server has no internet access, or no "curl"). */ public static function get_latest_version($type) { if ($type == 'stable' && !is_object(SystemVersion::$latest_stable_version) || $type == 'unstable' && !is_object(SystemVersion::$latest_unstable_version)) { $ini = curl_get_data('http://kami89.myparts.info/updates/latest.ini'); $ini_array = parse_ini_string($ini, true); SystemVersion::$latest_stable_version = new SystemVersion($ini_array['stable']['version']); SystemVersion::$latest_unstable_version = new SystemVersion($ini_array['unstable']['version']); } switch ($type) { case 'stable': return SystemVersion::$latest_stable_version; case 'unstable': return SystemVersion::$latest_unstable_version; default: debug('error', '$type=' . print_r($type, true), __FILE__, __LINE__, __METHOD__); throw new Exception('$type hat einen ungültigen Inhalt!'); } }