aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib/Command/DropLegacyFileKey.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption/lib/Command/DropLegacyFileKey.php')
-rw-r--r--apps/encryption/lib/Command/DropLegacyFileKey.php29
1 files changed, 6 insertions, 23 deletions
diff --git a/apps/encryption/lib/Command/DropLegacyFileKey.php b/apps/encryption/lib/Command/DropLegacyFileKey.php
index f0a5f36f30f..a9add1ad93b 100644
--- a/apps/encryption/lib/Command/DropLegacyFileKey.php
+++ b/apps/encryption/lib/Command/DropLegacyFileKey.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2023, Côme Chilliet <come.chilliet@nextcloud.com>
- *
- * @author Côme Chilliet <come.chilliet@nextcloud.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Encryption\Command;
@@ -75,10 +58,10 @@ class DropLegacyFileKey extends Command {
if ($result) {
$output->writeln('All scanned files are properly encrypted.');
- return 0;
+ return self::SUCCESS;
}
- return 1;
+ return self::FAILURE;
}
private function scanFolder(OutputInterface $output, string $folder): bool {
@@ -131,10 +114,10 @@ class DropLegacyFileKey extends Command {
$copyResource = $this->rootView->fopen($target, 'r');
$sourceResource = $this->rootView->fopen($source, 'w');
if ($copyResource === false || $sourceResource === false) {
- throw new DecryptionFailedException('Failed to open '.$source.' or '.$target);
+ throw new DecryptionFailedException('Failed to open ' . $source . ' or ' . $target);
}
if (stream_copy_to_stream($copyResource, $sourceResource) === false) {
- $output->writeln('<error>Failed to copy '.$target.' data into '.$source.'</error>');
+ $output->writeln('<error>Failed to copy ' . $target . ' data into ' . $source . '</error>');
$output->writeln('<error>Leaving both files in there to avoid data loss</error>');
return;
}