Skip to content

Commit b898d10

Browse files
committed
Made some changes to versioning
1 parent 80a9f9a commit b898d10

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

Diff for: CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
You want to contribute to SourceBans++, eh?
22
- If you're contributing to the SourceMod plugin, then just fork the repo, and make a Pull Request.
3-
- If you're contributing to the WebPanel, fork the repo, and make a pull request. We also need you to update the **init.php** file around line 84. You need to add up your commits in the PR, then add one more commit for the Merge. Then add the counted up commits to the **SB_GITRev** value.
3+
- If you're contributing to the WebPanel, fork the repo, and make a pull request. We also need you to update the **version.json** file. You need to add up your commits in the PR, then add one more commit for the Merge. Then add the counted up commits to the **git** value.

Diff for: web/includes/sb-callback.php

+8-11
Original file line numberDiff line numberDiff line change
@@ -2314,36 +2314,33 @@ function SendMail($subject, $message, $type, $id)
23142314
function CheckVersion()
23152315
{
23162316
$objResponse = new xajaxResponse();
2317-
$relver = @file_get_contents("https://sbpp.sarabveer.me/rel/");
2318-
2319-
if(defined('SB_GIT'))
2320-
$relgit = @file_get_contents("https://sbpp.sarabveer.me/dev/");
2317+
$version = json_decode(file_get_contents("https://sbpp.github.io/version.json"), true);
23212318

23222319
if(version_compare($relver, SB_VERSION) > 0)
23232320
$versmsg = "<span style='color:#aa0000;'><strong>A new release is available.</strong></span>";
23242321
else
23252322
$versmsg = "<span style='color:#00aa00;'><strong>You have the latest release.</strong></span>";
23262323

23272324
$msg = $versmsg;
2328-
if(strlen($relver)>8 || $relver=="") {
2329-
$relver = "<span style='color:#aa0000;'>Error</span>";
2325+
if(strlen($version['version'])>8 || $version['version']=="") {
2326+
$version['version'] = "<span style='color:#aa0000;'>Error</span>";
23302327
$msg = "<span style='color:#aa0000;'><strong>Error retrieving latest release.</strong></span>";
23312328
}
2332-
$objResponse->addAssign("relver", "innerHTML", $relver);
2329+
$objResponse->addAssign("relver", "innerHTML", $version['version']);
23332330

23342331
if(defined('SB_GIT'))
23352332
{
2336-
if(intval($relgit) > GetGITRev())
2333+
if(intval($version['git']) > SB_GITREV)
23372334
$svnmsg = "<span style='color:#aa0000;'><strong>A new Dev release is available.</strong></span>";
23382335
else
23392336
$svnmsg = "<span style='color:#00aa00;'><strong>You have the latest Dev release.</strong></span>";
23402337

2341-
if(strlen($relgit)>8 || $relgit=="") {
2342-
$relgit = "<span style='color:#aa0000;'>Error</span>";
2338+
if(strlen($version['git'])>8 || $version['git']=="") {
2339+
$version['git'] = "<span style='color:#aa0000;'>Error</span>";
23432340
$svnmsg = "<span style='color:#aa0000;'><strong>Error retrieving latest Git Commit.</strong></span>";
23442341
}
23452342
$msg .= "<br />" . $svnmsg;
2346-
$objResponse->addAssign("svnrev", "innerHTML", $relgit);
2343+
$objResponse->addAssign("svnrev", "innerHTML", $version['git']);
23472344
}
23482345

23492346
$objResponse->addAssign("versionmsg", "innerHTML", $msg);

Diff for: web/init.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,14 @@
106106
// ---------------------------------------------------
107107
define('SB_GIT', true);
108108
if (!defined('SB_VERSION')) {
109-
define('SB_VERSION', '1.6.0');
110-
define('SB_GITREV', '474');
109+
if (file_exists('version.json')) {
110+
$json = json_decode(file_get_contents('version.json'), true);
111+
define('SB_VERSION', $json['version']);
112+
define('SB_GITREV', $json['git']);
113+
} else {
114+
define('SB_VERSION', 'N/A');
115+
define('SB_GITREV', '0');
116+
}
111117
}
112118
define('LOGIN_COOKIE_LIFETIME', (60*60*24*7)*2);
113119
define('COOKIE_PATH', '/');

Diff for: web/version.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"version": "1.6.0",
3+
"git": "476"
4+
}

0 commit comments

Comments
 (0)