summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-12-09 17:46:05 +0100
committerLukas Reschke <lukas@statuscode.ch>2016-12-09 18:01:45 +0100
commit32bf8ec826dadbfd342627884fbdf83081db9b29 (patch)
treecdaa5a962fc20203a8a3143f5e30674b8b5d77fb /lib/private
parent0de83a3a0189a96338abd0345b70c89bc543bf49 (diff)
downloadnextcloud-server-32bf8ec826dadbfd342627884fbdf83081db9b29.tar.gz
nextcloud-server-32bf8ec826dadbfd342627884fbdf83081db9b29.zip
Don't use cached informations for app version
When installing an app from the appstore the `\OC_App::getAppVersion` code is triggered twice: - First when the downloader tries to compare the current version to the new version on the appstore to check if there is a newer version. This protects against downgrade attacks and is implemented in `\OC\Installer::downloadApp`. - Second, when the app is actually installed the current version is written to the database. (`\OC\Installer::installApp`) This fails however when the version is actually cached. Because in step 1 the cached version will be set to "0" and then be reused in the second step. While this is probably not the cleanest version I assume this is an approach that is least invasive. Feedback and suggestions welcome :) Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Installer.php2
-rw-r--r--lib/private/legacy/app.php11
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index db71f7b1432..38d0ce13684 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -121,7 +121,7 @@ class Installer {
OC_App::executeRepairSteps($appId, $appData['repair-steps']['install']);
//set the installed version
- \OC::$server->getConfig()->setAppValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
+ \OC::$server->getConfig()->setAppValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id'], false));
\OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no');
//set remote/public handlers
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index 0d9adfa9d2b..adf29601ac6 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -653,13 +653,16 @@ class OC_App {
* get the last version of the app from appinfo/info.xml
*
* @param string $appId
+ * @param bool $useCache
* @return string
*/
- public static function getAppVersion($appId) {
- if (!isset(self::$appVersion[$appId])) {
- $file = self::getAppPath($appId);
- self::$appVersion[$appId] = ($file !== false) ? self::getAppVersionByPath($file) : '0';
+ public static function getAppVersion($appId, $useCache = true) {
+ if($useCache && isset(self::$appVersion[$appId])) {
+ return self::$appVersion[$appId];
}
+
+ $file = self::getAppPath($appId);
+ self::$appVersion[$appId] = ($file !== false) ? self::getAppVersionByPath($file) : '0';
return self::$appVersion[$appId];
}
w"> : "Имя точки монтирования содержит недопустимые символы.", "Invalid or untrusted SSL certificate" : "Недействительный или недоверенный сертификат SSL", "Couldn't add remote share" : "Невозможно добавить удалённый общий ресурс", "Shared with you" : "Поделились с вами", "Shared with others" : "Доступные для других", "Shared by link" : "Доступные по ссылке", "Nothing shared with you yet" : "С вами пока ничем не поделились", "Files and folders others share with you will show up here" : "Здесь появятся файлы и каталоги, которыми с вами поделятся", "Nothing shared yet" : "Пока ничего не опубликовано", "Files and folders you share will show up here" : "Здесь появятся файлы и каталоги, которыми вы поделитесь", "No shared links" : "Нет общих ссылок", "Files and folders you share by link will show up here" : "Здесь появятся файлы и каталоги, ссылкой на которые вы поделитесь", "Do you want to add the remote share {name} from {owner}@{remote}?" : "Добавить удалённую общую папку {name} из {owner}@{remote}?", "Remote share" : "Удаленный общий ресурс", "Remote share password" : "Пароль для удаленного общего ресурса", "Cancel" : "Отменить", "Add remote share" : "Добавить удалённый общий ресурс", "No ownCloud installation (7 or higher) found at {remote}" : "На удаленном ресурсе {remote} не установлен ownCloud версии 7 или выше", "Invalid ownCloud url" : "Неверный адрес ownCloud", "Share" : "Поделиться", "Shared by" : "Поделился", "A file or folder was shared from <strong>another server</strong>" : "Файлом или каталогом поделились с <strong>удаленного сервера</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Общий файл или каталог был <strong>скачан</strong>", "You received a new remote share from %s" : "%s поделился с вами удаленным общим ресурсом", "%1$s accepted remote share %2$s" : "%1$s принял удаленный общий ресурс %2$s", "%1$s declined remote share %2$s" : "%1$s отклонил удаленный общий ресурс %2$s", "%1$s unshared %2$s from you" : "%1$s закрыл для вас доступ к %2$s ", "Public shared folder %1$s was downloaded" : "Общий каталог %1$s был скачан", "Public shared file %1$s was downloaded" : "Общий файл %1$s, был скачан", "This share is password-protected" : "Общий ресурс защищен паролем", "The password is wrong. Try again." : "Неверный пароль. Попробуйте еще раз.", "Password" : "Пароль", "No entries found in this folder" : "Каталог пуст", "Name" : "Имя", "Share time" : "Дата публикации", "Sorry, this link doesn’t seem to work anymore." : "Эта ссылка устарела и более не действительна.", "Reasons might be:" : "Причиной может быть:", "the item was removed" : "элемент был удалён", "the link expired" : "срок действия ссылки истёк", "sharing is disabled" : "общий доступ отключён", "For more info, please ask the person who sent this link." : "Для получения дополнительной информации, свяжитесь с тем, кто отправил вам эту ссылку.", "Add to your ownCloud" : "Добавить в свой ownCloud", "Download" : "Скачать", "Download %s" : "Скачать %s", "Direct link" : "Прямая ссылка", "Server-to-Server Sharing" : "Межсерверное предоставление доступа", "Allow users on this server to send shares to other servers" : "Разрешить пользователям делиться с пользователями других серверов", "Allow users on this server to receive shares from other servers" : "Разрешить пользователям использовать общие ресурсы с других серверов" }, "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);");