-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore encrypted version to original if no fix was found
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?php | ||
/** | ||
* @author Sujith Haridasan <[email protected]> | ||
* @author Ilja Neumann <[email protected]> | ||
* | ||
* @copyright Copyright (c) 2019, ownCloud GmbH | ||
* @license AGPL-3.0 | ||
|
@@ -185,6 +186,8 @@ private function correctEncryptedVersion($path, OutputInterface $output) { | |
return true; | ||
} | ||
|
||
// Save original encrypted version so we can restore it if decryption fails with all version | ||
$originalEncryptedVersion = $encryptedVersion; | ||
if ($encryptedVersion >= 0) { | ||
//test by decrementing the value till 1 and if nothing works try incrementing | ||
$encryptedVersion--; | ||
|
@@ -222,6 +225,11 @@ private function correctEncryptedVersion($path, OutputInterface $output) { | |
$increment++; | ||
} | ||
} | ||
|
||
$cacheInfo = ['encryptedVersion' => $originalEncryptedVersion, 'encrypted' => $originalEncryptedVersion]; | ||
$cache->put($fileCache->getPath(), $cacheInfo); | ||
$output->writeln("<info>No fix found for $path, restored version to original: $originalEncryptedVersion</info>"); | ||
|
||
return false; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters