Add admin info to stats Endpoint

This commit is contained in:
Philipp 2024-10-21 07:24:24 +02:00
parent e8ab8a84af
commit 7ca4e6e338
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
4 changed files with 80 additions and 14 deletions

View file

@ -24,6 +24,44 @@ class Update
const NEW_TABLE_STRUCTURE_VERSION = 1288;
/**
* Returns the status of the current update
*
* @return int
*/
public static function getStatus(): int
{
return (int)DI::config()->get('system', 'update') ?? static::SUCCESS;
}
/**
* Returns the latest Version of the Friendica git repository and null, if this node doesn't check updates automatically
*
* @return string
*/
public static function getAvailableVersion(): ?string
{
return DI::keyValue()->get('git_friendica_version') ?? null;
}
/**
* Returns true, if there's a new update and null if this node doesn't check updates automatically
*
* @return bool|null
*/
public static function isAvailable(): ?bool
{
if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') {
if (version_compare(App::VERSION, static::getAvailableVersion()) < 0) {
return true;
} else {
return false;
}
}
return null;
}
/**
* Function to check if the Database structure needs an update.
*