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
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <DeepDiver1975@users.noreply.github.com>2016-07-01 12:30:39 +0300
committerGitHub <noreply@github.com>2016-07-01 12:30:39 +0300
commit4ac256ea6cd14f531dad0841ce7a9c5f5ffdeb51 (patch)
treeac79e6d294c44e0cbfc4a96001c87fb240f1ff15 /lib
parent4a4103b92375b191700b9e0f52fe363d3fe989ff (diff)
[stable9] Fix decrypt message stable9 (#25188)
* Fix Decrypt message via occ * Comments fixed * Fixed reviews * Originally: commit 2304e4bda027e61ff1302c55c2f70f8e4c8f47d0 Author: Joas Schilling <nickvergessen@owncloud.com> Date: Tue Jun 7 09:13:11 2016 +0200 Allow to decrypt user '0' files only * Fix uid comparison
Diffstat (limited to 'lib')
-rw-r--r--lib/private/encryption/decryptall.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/private/encryption/decryptall.php b/lib/private/encryption/decryptall.php
index 7a965a5f227..34a3e1bff91 100644
--- a/lib/private/encryption/decryptall.php
+++ b/lib/private/encryption/decryptall.php
@@ -1,6 +1,6 @@
<?php
/**
- * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Björn Schießle <bjoern@schiessle.org>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
@@ -80,7 +80,7 @@ class DecryptAll {
$this->input = $input;
$this->output = $output;
- if (!empty($user) && $this->userManager->userExists($user) === false) {
+ if ($user !== '' && $this->userManager->userExists($user) === false) {
$this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again');
return false;
}
@@ -133,6 +133,7 @@ class DecryptAll {
/**
* iterate over all user and encrypt their files
+ *
* @param string $user which users files should be decrypted, default = all users
*/
protected function decryptAllUsersFiles($user = '') {
@@ -140,7 +141,7 @@ class DecryptAll {
$this->output->writeln("\n");
$userList = [];
- if (empty($user)) {
+ if ($user === '') {
$fetchUsersProgress = new ProgressBar($this->output);
$fetchUsersProgress->setFormat(" %message% \n [%bar%]");
@@ -200,9 +201,9 @@ class DecryptAll {
$this->setupUserFS($uid);
$directories = array();
- $directories[] = '/' . $uid . '/files';
+ $directories[] = '/' . $uid . '/files';
- while($root = array_pop($directories)) {
+ while ($root = array_pop($directories)) {
$content = $this->rootView->getDirectoryContent($root);
foreach ($content as $file) {
$path = $root . '/' . $file['name'];
@@ -213,9 +214,14 @@ class DecryptAll {
try {
$progress->setMessage("decrypt files for user $userCount: $path");
$progress->advance();
- if ($this->decryptFile($path) === false) {
+ if ($file->isEncrypted() === false) {
$progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
$progress->advance();
+ } else {
+ if ($this->decryptFile($path) === false) {
+ $progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
+ $progress->advance();
+ }
}
} catch (\Exception $e) {
if (isset($this->failed[$uid])) {