Support hidden version in status.php taking version from capabilities…#1936
Support hidden version in status.php taking version from capabilities…#1936
Conversation
| if (serverVersionStr != null) { | ||
| serverVersion = new OwnCloudVersion(serverVersionStr); | ||
| // capabilities are now the preferred source for version info | ||
| FileDataStorageManager fds = new FileDataStorageManager( |
There was a problem hiding this comment.
I would rename fds variable name to a more specific one like fileDataStorageManager. In this part of the code, you know exactly what it is, but if you use it in other part below, you won't know it.
| } | ||
| } | ||
| } | ||
| return serverVersion; |
There was a problem hiding this comment.
This serverVersion could be returned as null, I guess this will be take into account in the method which calls it
There was a problem hiding this comment.
Added @nullable to method to make it clearer to callers; they had it into account before, also.
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * <p> |
There was a problem hiding this comment.
Not important, but these <p> characters could be deleted
| * @author David A. Velasco | ||
| * @author masensio | ||
| * Copyright (C) 2017 ownCloud GmbH. | ||
| * <p> |
| RemoteOperationResult result = getCapabilities.execute(getStorageManager(), mContext); | ||
| if (!result.isSuccess()){ | ||
| Log_OC.w(TAG, "Update Capabilities unsuccessfully"); | ||
| private OwnCloudVersion updateCapabilities() { |
There was a problem hiding this comment.
I'm not sure if updateCapabilities would be a good name for this method since you are getting something, not setting it. Besides, this method could be also useful in other parts of the code, have you thinked about moving it to a generic capabilities class with several methods related to it?
Edition: I've just seen that SyncCapabilitiesOperation is getting and saving the capabilities. Method name LGTM but consider if moving it to a capabilities util class would worth it.
There was a problem hiding this comment.
I renamed the method to 'syncCapabilities()', that is more accurate.
Reading the code of the method I really hope we never need to reuse this in any other place. First, it returns an OwnCloudVersion instance as a 'side effect' of syncing capabilities, instead of returning capabilities instance, so the name of the method is confusing. Second, it checks the AccountManager for the version as a fallback for servers that do not respond capabilities (or don't support them), code that I would prefer to get rid of because users just should update to servers with capabilities API instead of staying with elder ones - but I don't trust enough that if we forget that possibility it will not bite us back.
Besides, util classes, the lesser, the better. Static methods are perfect to trigger career conditions in multithreaded environments. Or to dump all kind of stuff in without thinking twice.
EDIT: renamed again so that returned value is not so confusing.
a41088b to
d653999
Compare
|
@davigonz , updated. |
d653999 to
2d98698
Compare
|
Pending on the server PR: owncloud/core#27473 |
b9d8694 to
7447cd1
Compare
|
Trying to work around the weird block of repeated license/cla check. Will close the PR and create a new one. |
|
This is stupid. @DeepDiver1975 , please, take a look to repo configuration. We can't merge recent PRs. Same problem in the iOS repo. |
|
QA Approved. |
|
By the way: the wrong check says "licence/cla" while the correct one say "license/cla" : licence Vs license . I suspect has something to do with the block. |
|
@DeepDiver1975 , I suspect that in the repository configuration the protection of master branch is requiring a test with context licence/cla instead of license/cla. That was probably changed recently, and is blocking the PRs. Please, take a look when possible. |
… API as preferred
7447cd1 to
3765244
Compare
… API as preferred.
Fixes #1931
Requires owncloud/android-library#156