-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add update info to serverinfo api call #434
Conversation
74f53e9
to
aa4743d
Compare
Updated pull requests with fixes from php-cs fixer |
@JuliaKirschenheuter you should be able to merge this already with your review... |
@blizzz could you please make a second review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
json_decode invocation
And another thing, sorry i did not realize it earlier, |
Refactored logic into handling the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your pull request 👍
It would be better if the updatenotification app, which comes with the server, had an endpoint to ask for this information programmatically.
Fine by me to expose that an update is available. If we decide to keep lastupdatedat and available_version this should go into an own method (similar to getAppsInfo) to keep the code simple.
lib/SystemStatistics.php
Outdated
@@ -54,8 +54,20 @@ public function __construct(IConfig $config, IAppManager $appManager, Installer | |||
public function getSystemStatistics(): array { | |||
$processorUsage = $this->getProcessorUsage(); | |||
$memoryUsage = $this->os->getMemory(); | |||
$updateInfo = []; | |||
$updateInfo['lastupdatedat'] = (int) $this->config->getAppValue('core', 'lastupdatedat'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you need lastupdatedat
for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lastupdatedat
is useful to verify that the update check was run recently, and the information isn't totally outdated. I'm open to better ideas how to name it, since it might be unclear what was last updated, the server or the information about updates? (see comment below for indepth response)
lib/SystemStatistics.php
Outdated
if (is_array($lastUpdateResult)) { | ||
$updateInfo['available'] = ( count($lastUpdateResult) > 0); | ||
if( array_key_exists('version', $lastUpdateResult)) { | ||
$updateInfo['available_version'] = $lastUpdateResult['version']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you need available_version
for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the available_version exposed, let's us check directly from monitoring if the update is a minor or major upgrade, compared to the installed version. (see comment below for indepth response)
I agree that this might make more sense thematically, but since the available app updates are already exposed by the serverinfo this seems like a reasonable addition. Having the
|
To fix the linter and improve readability.
To fix the DCO check, please sign off your commits: https://probot.github.io/apps/dco/ |
Signed-off-by: Mathias Petermann <mathias.petermann@gmail.com>
Applied patch, squashed commits, signed-off |
Add information if nextcloud update is available to the
SystemStatistics
.Will show the output of the last update check and not perform a new one.
If no new version is available
update. available_version
will benull
Fixes #211