Fixed console update latest string get version issue..

This commit is contained in:
Cüneyt Şentürk 2023-05-26 11:38:46 +03:00
parent 460c1f2495
commit 99ed3c15a0

View File

@ -56,7 +56,7 @@ class Versions
$versions = static::all($alias);
if (empty($versions[$alias])) {
return false;
return static::getVersionByAlias($alias);
}
return $versions[$alias];
@ -128,6 +128,30 @@ class Versions
return $versions;
}
public static function getVersionByAlias($alias)
{
$info = Info::all();
// Check core first
$url = 'core/version/' . $info['akaunting'] . '/' . $info['php'] . '/' . $info['mysql'] . '/' . $info['companies'];
$version = $info['akaunting'];
if ($alias != 'core') {
$version = module($alias)->get('version');
$url = 'apps/' . $alias . '/version/' . $version . '/' . $info['akaunting'];
}
// Get data from cache
$versions = Cache::get('versions', []);
$versions[$alias] = static::getLatestVersion($url, $version);
Cache::put('versions', $versions, Date::now()->addHour(6));
return $versions[$alias];
}
public static function getLatestVersion($url, $latest)
{
$version = new \stdClass();