Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-12-09 19:46:05 +0300
committerLukas Reschke <lukas@statuscode.ch>2016-12-09 20:01:45 +0300
commit32bf8ec826dadbfd342627884fbdf83081db9b29 (patch)
treecdaa5a962fc20203a8a3143f5e30674b8b5d77fb /tests/lib/InstallerTest.php
parent0de83a3a0189a96338abd0345b70c89bc543bf49 (diff)
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 'tests/lib/InstallerTest.php')
-rw-r--r--tests/lib/InstallerTest.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php
index dadaffe1879..d1923970588 100644
--- a/tests/lib/InstallerTest.php
+++ b/tests/lib/InstallerTest.php
@@ -73,6 +73,9 @@ class InstallerTest extends TestCase {
}
public function testInstallApp() {
+ // Read the current version of the app to check for bug #2572
+ \OC_App::getAppVersion('testapp');
+
// Extract app
$pathOfTestApp = __DIR__ . '/../data/testapp.zip';
$tar = new ZIP($pathOfTestApp);
@@ -88,6 +91,7 @@ class InstallerTest extends TestCase {
$installer->installApp(self::$appid);
$isInstalled = Installer::isInstalled(self::$appid);
$this->assertTrue($isInstalled);
+ $this->assertSame('0.9', \OC::$server->getConfig()->getAppValue('testapp', 'installed_version'));
$installer->removeApp(self::$appid);
}