ALPHA 3.0.2a

This commit is contained in:
TheGamecraft
2018-09-10 08:51:18 -04:00
parent 7fe13ae0a7
commit 0e0ef86b71
1404 changed files with 10604 additions and 33714 deletions

View File

@@ -24,7 +24,7 @@ class GitHubChecker implements Checker
*/
public function isLatest()
{
return version_compare(Shell::VERSION, $this->getLatest(), '>=');
return \version_compare(Shell::VERSION, $this->getLatest(), '>=');
}
/**
@@ -68,22 +68,22 @@ class GitHubChecker implements Checker
*/
public function fetchLatestRelease()
{
$context = stream_context_create([
$context = \stream_context_create([
'http' => [
'user_agent' => 'PsySH/' . Shell::VERSION,
'timeout' => 3,
],
]);
set_error_handler(function () {
\set_error_handler(function () {
// Just ignore all errors with this. The checker will throw an exception
// if it doesn't work :)
});
$result = @file_get_contents(self::URL, false, $context);
$result = @\file_get_contents(self::URL, false, $context);
restore_error_handler();
\restore_error_handler();
return json_decode($result);
return \json_decode($result);
}
}

View File

@@ -11,8 +11,6 @@
namespace Psy\VersionUpdater;
use Psy\Shell;
class IntervalChecker extends GitHubChecker
{
private $cacheFile;
@@ -27,7 +25,7 @@ class IntervalChecker extends GitHubChecker
public function fetchLatestRelease()
{
// Read the cached file
$cached = json_decode(@file_get_contents($this->cacheFile, false));
$cached = \json_decode(@\file_get_contents($this->cacheFile, false));
if ($cached && isset($cached->last_check) && isset($cached->release)) {
$now = new \DateTime();
$lastCheck = new \DateTime($cached->last_check);
@@ -60,10 +58,10 @@ class IntervalChecker extends GitHubChecker
private function updateCache($release)
{
$data = [
'last_check' => date(DATE_ATOM),
'last_check' => \date(DATE_ATOM),
'release' => $release,
];
file_put_contents($this->cacheFile, json_encode($data));
\file_put_contents($this->cacheFile, \json_encode($data));
}
}