fixed 31 compability, close #177

This commit is contained in:
benson
2025-03-09 07:33:34 +08:00
parent 5f97dd0381
commit 05fa403bd9

View File

@@ -516,7 +516,9 @@ class Helper
} }
public static function getVersion(): array public static function getVersion(): array
{ {
return \OC_Util::getVersion(); $config = \OC::$server->get(\OCP\IConfig::class);
$version = $config->getSystemValue('version');
return explode(".", $version);
} }
public static function isLegacyVersion(): bool public static function isLegacyVersion(): bool
{ {
@@ -634,8 +636,8 @@ class Helper
$response = $client->request('GET', $downloadUrl); $response = $client->request('GET', $downloadUrl);
if ($byte = file_put_contents($file, $response->getContent())) { if ($byte = file_put_contents($file, $response->getContent())) {
return $byte; return $byte;
}else { } else {
throw new \Exception("Failed to download $downloadUrl"); throw new \Exception("Failed to download $downloadUrl");
} }
} }
return false; return false;