Skip to content

Commit 411aea7

Browse files
committed
refactor: update update_checker to use new versioning system
Update checker now uses the local version.json file for checks.. Seems nicer this way.
1 parent 8c9c5cf commit 411aea7

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

index.php

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
require_once("utils/params.php");
2828
require_once("utils/update_checker.php");
2929

30+
Update::getCurrentVersion();
31+
3032
$config = Config::getConfig();
3133
$parser = ParamParser::getParser();
3234
?>

utils/update_checker.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22

33
class Update{
44

5-
private static $version = "2.1.1";
6-
private static $url = "https://gist.githubusercontent.com/TGRHavoc/581ec66730b7abafe49ab616db87b0bb/raw/f27c6f2573dd1df0692f97c78a73f5687d20f791/live_map.versions";
5+
private static $version = "2.1.3";
6+
private static $url = "https://raw.githubusercontent.com/TGRHavoc/live_map-interface/master/version.json";
77

88
public static function latestVersion(){
99
$data = file_get_contents(self::$url);
1010
$data = json_decode($data);
1111

1212
return $data->interface == self::$version;
1313
}
14+
15+
public static function getCurrentVersion(){
16+
$ver = file_get_contents("version.json") or die("Please contact the web admin. \"version.json\" doesn't exist! How am I supposed to check for updates?");
17+
$ver = json_decode($ver);
18+
19+
self::$version = $ver->interface;
20+
}
21+
1422
}
1523

1624
?>

version.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"interface" : "2.1.3"
3+
}

0 commit comments

Comments
 (0)