From 5c538f05440e07977f0cfab49bec7733450e4888 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Mon, 22 Jul 2019 00:59:56 +0200 Subject: [PATCH] Exclude .rnd files Signed-off-by: Daniel Kesselberg --- index.php | 3 ++ lib/RecursiveDirectoryIteratorWithoutData.php | 1 + lib/Updater.php | 2 ++ tests/features/bootstrap/FeatureContext.php | 8 +++-- tests/features/stable15.feature | 33 +++++++++++++++++- tests/features/stable16.feature | 2 +- updater.phar | Bin 599747 -> 599781 bytes 7 files changed, 45 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 99a52f9..2c4ac37 100644 --- a/index.php +++ b/index.php @@ -40,6 +40,7 @@ class RecursiveDirectoryIteratorWithoutData extends \RecursiveFilterIterator { public function accept() { /** @var \DirectoryIterator $this */ $excludes = [ + '.rnd', '.well-known', 'data', '..', @@ -318,6 +319,7 @@ class Updater { 'themes', 'updater', // Files + '.rnd', 'index.html', 'indie.json', '.user.ini', @@ -461,6 +463,7 @@ class Updater { $this->silentLog('[info] createBackup()'); $excludedElements = [ + '.rnd', '.well-known', 'data', ]; diff --git a/lib/RecursiveDirectoryIteratorWithoutData.php b/lib/RecursiveDirectoryIteratorWithoutData.php index 3b9ae76..13f0a40 100644 --- a/lib/RecursiveDirectoryIteratorWithoutData.php +++ b/lib/RecursiveDirectoryIteratorWithoutData.php @@ -26,6 +26,7 @@ class RecursiveDirectoryIteratorWithoutData extends \RecursiveFilterIterator { public function accept() { /** @var \DirectoryIterator $this */ $excludes = [ + '.rnd', '.well-known', 'data', '..', diff --git a/lib/Updater.php b/lib/Updater.php index d730e16..0434d87 100644 --- a/lib/Updater.php +++ b/lib/Updater.php @@ -202,6 +202,7 @@ class Updater { 'themes', 'updater', // Files + '.rnd', 'index.html', 'indie.json', '.user.ini', @@ -345,6 +346,7 @@ class Updater { $this->silentLog('[info] createBackup()'); $excludedElements = [ + '.rnd', '.well-known', 'data', ]; diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php index 31bfac4..722e3b6 100644 --- a/tests/features/bootstrap/FeatureContext.php +++ b/tests/features/bootstrap/FeatureContext.php @@ -249,6 +249,12 @@ WbRmf4trGwDdCA/kQ59LInfLR8KFfEiiOH2p2NijgXuWm49tdr7N1062diP4Dzwd WlWfRoT8G5DDQPGdj5a72+sQLjf3ZhjqgeQbGLwht/NonWLZhmmW/NgmylbCb9Ob a7NE4Vf792DrmBvq4HCHUexg+upaJ0s4sJLGqg3sWF8iUEnLyGePyL/Bw6MeLvjD sSD0Xb5oawIjTVHVAuL+3Q==', + '15.0.10' => '1FcyXT8cgPMctfn+S5QLGbPrkeXEWyaIGh1T9mP7BHaF5AHamuAGDzk04FKHYB/e +OylmXzDBE2w1LG5AOABAw3idwIJpfvH2dyi8tsBNdcGKY01DmMYEzn4y5i2r5Duv +lRjhRfuk/MrjUOH1XkGO1xPI8zXp8eI7Y53jHswbUayJGszzgCKcuC6z+QEUkf7v +p15duG8nbbF1c3CAh/dVsJ2AKKpcnLYJPC8UgGDXMtalSoPUv9QTWPrS7AqQRsVD +7xJThvWdx3aSV3aKREBzw5ddHUAIEENQ0aBdabgAXbBZEfLrMMG2XaHtdXGLpQs8 +ypwcWVvLfYk9e+YEMdhMNg==', '16.0.3' => 'TYiUB/+l2uXNpiHGuMhchHzzyMn8eiL2mzBD+fmwqUXU29UYK4FFvTbDEWWXxXF9 XeOXXBTkWltQ6A5K+nwFx4Phf4VPznaGn3U/1hsLSLBy9p9qqBMQdmDvCxl4dJmP R0Ttz6sGcC1AsYwW2Q5Z1lywpmk1Ax5YcJesbjOFTU9HXIOI2s9YyPX4bP3L1rkH @@ -382,8 +388,6 @@ b813iKq4+cn3CjTunREm6A==', require $this->serverDir . 'nextcloud/version.php'; $installedVersion = join('.', $OC_Version); - // Hack for version number mapping - $installedVersion = str_replace(['9.1', '9.2'], ['10.0', '11.0'], $installedVersion); if (strpos($installedVersion, $version) !== 0) { throw new Exception('Version mismatch - Installed: ' . $installedVersion . ' Wanted: ' . $version); diff --git a/tests/features/stable15.feature b/tests/features/stable15.feature index 202d6ed..1b4ba20 100644 --- a/tests/features/stable15.feature +++ b/tests/features/stable15.feature @@ -1,4 +1,4 @@ -Feature: CLI updater - stable14 base +Feature: CLI updater - stable15 base Scenario: Update is available - 15.0.0 beta 1 to 15.0.0 RC 1 Given the current installed version is 15.0.0beta1 @@ -10,6 +10,37 @@ Feature: CLI updater - stable14 base And maintenance mode should be off And upgrade is not required + Scenario: Update is available but unexpected folder found - 15.0.9 to 15.0.10 + Given the current installed version is 15.0.9 + And there is an update to version 15.0.10 available + And there is a folder called "test123" + When the CLI updater is run + Then the return code should not be 0 + And the output should contain "The following extra files have been found" + Then the installed version should be 15.0.9 + And maintenance mode should be off + And upgrade is not required + + Scenario: Update is available and .well-known folder exist - 15.0.9 to 15.0.10 + Given the current installed version is 15.0.9 + And there is an update to version 15.0.10 available + And there is a folder called ".well-known" + When the CLI updater is run successfully + And the output should contain "Update successful" + Then the installed version should be 15.0.10 + And maintenance mode should be off + And upgrade is not required + + Scenario: Update is available and .rnd file exist - 15.0.9 to 15.0.10 + Given the current installed version is 15.0.9 + And there is an update to version 15.0.10 available + And there is a folder called ".rnd" + When the CLI updater is run successfully + And the output should contain "Update successful" + Then the installed version should be 15.0.10 + And maintenance mode should be off + And upgrade is not required + Scenario: Update is available - 15.0.0 to master daily Given the current installed version is 15.0.0RC1 And PHP is at least in version 7.0 diff --git a/tests/features/stable16.feature b/tests/features/stable16.feature index f153da6..5ed5e8e 100644 --- a/tests/features/stable16.feature +++ b/tests/features/stable16.feature @@ -1,4 +1,4 @@ -Feature: CLI updater - stable14 base +Feature: CLI updater - stable16 base Scenario: Update is available - 16.0.1 to 16.0.3 Given the current installed version is 16.0.0 diff --git a/updater.phar b/updater.phar index 42f9cf8bdd89825b51a374ca2a2f7b0007dd53c0..d89ee4bf1d46da89e8e5c7c0eb5ffe239b77daaa 100755 GIT binary patch delta 1506 zcmXw3YfKbZ6uz_1S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