From 703214fd9c4406e0bf978fe7d09962055b6d2295 Mon Sep 17 00:00:00 2001 From: yemkareems Date: Mon, 15 Apr 2024 16:12:29 +0530 Subject: [PATCH 1/4] feat: command added to clear avatar cache manually Signed-off-by: yemkareems --- .../User/ClearGeneratedAvatarCacheCommand.php | 49 +++++++++++++++++++ core/register_command.php | 1 + 2 files changed, 50 insertions(+) create mode 100644 core/Command/User/ClearGeneratedAvatarCacheCommand.php diff --git a/core/Command/User/ClearGeneratedAvatarCacheCommand.php b/core/Command/User/ClearGeneratedAvatarCacheCommand.php new file mode 100644 index 00000000000..c472964b208 --- /dev/null +++ b/core/Command/User/ClearGeneratedAvatarCacheCommand.php @@ -0,0 +1,49 @@ + + * + * @author Kareem + * + * @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 . + * + */ +namespace OC\Core\Command\User; + +use OC\Avatar\AvatarManager; +use OC\Core\Command\Base; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class ClearGeneratedAvatarCacheCommand extends Base { + public function __construct( + protected AvatarManager $avatarManager, + ) { + parent::__construct(); + } + + protected function configure(): void { + $this + ->setName('user:clear-avatar-cache') + ->setDescription('clear avatar cache'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int { + $output->writeln("cleared avatar cache started"); + $this->avatarManager->clearCachedAvatars(); + $output->writeln("cleared avatar cache successfully"); + return 0; + } +} diff --git a/core/register_command.php b/core/register_command.php index 4a84e551ce0..97b75f17625 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -156,6 +156,7 @@ if ($config->getSystemValueBool('installed', false)) { $application->add(Server::get(Command\User\ResetPassword::class)); $application->add(Server::get(Command\User\Setting::class)); $application->add(Server::get(Command\User\ListCommand::class)); + $application->add(Server::get(Command\User\ClearGeneratedAvatarCacheCommand::class)); $application->add(Server::get(Command\User\Info::class)); $application->add(Server::get(Command\User\SyncAccountDataCommand::class)); $application->add(Server::get(Command\User\AuthTokens\Add::class)); From 5201056b7e63c5d152d87717509f9dbf058d8ad0 Mon Sep 17 00:00:00 2001 From: yemkareems Date: Tue, 16 Apr 2024 08:53:15 +0530 Subject: [PATCH 2/4] feat: license wordings, minor php warnings corrected Signed-off-by: yemkareems --- .../Command/User/ClearGeneratedAvatarCacheCommand.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/Command/User/ClearGeneratedAvatarCacheCommand.php b/core/Command/User/ClearGeneratedAvatarCacheCommand.php index c472964b208..3ad7726d56c 100644 --- a/core/Command/User/ClearGeneratedAvatarCacheCommand.php +++ b/core/Command/User/ClearGeneratedAvatarCacheCommand.php @@ -1,10 +1,9 @@ + * @copyright Copyright (c) 2024, Nextcloud GmbH * * @author Kareem - * - * @license GNU AGPL version 3 or any later version + * @license AGPL-3.0-or-later * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -36,12 +35,12 @@ class ClearGeneratedAvatarCacheCommand extends Base { protected function configure(): void { $this - ->setName('user:clear-avatar-cache') - ->setDescription('clear avatar cache'); + ->setDescription('clear avatar cache') + ->setName('user:clear-avatar-cache'); } protected function execute(InputInterface $input, OutputInterface $output): int { - $output->writeln("cleared avatar cache started"); + $output->writeln("clearing avatar cache started"); $this->avatarManager->clearCachedAvatars(); $output->writeln("cleared avatar cache successfully"); return 0; From 04b112c941265fbba1f36b1cca1b3914963c94da Mon Sep 17 00:00:00 2001 From: yemkareems Date: Tue, 16 Apr 2024 13:59:34 +0530 Subject: [PATCH 3/4] feat: wordings corrected as suggested Signed-off-by: yemkareems --- core/Command/User/ClearGeneratedAvatarCacheCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Command/User/ClearGeneratedAvatarCacheCommand.php b/core/Command/User/ClearGeneratedAvatarCacheCommand.php index 3ad7726d56c..69421846049 100644 --- a/core/Command/User/ClearGeneratedAvatarCacheCommand.php +++ b/core/Command/User/ClearGeneratedAvatarCacheCommand.php @@ -40,9 +40,9 @@ class ClearGeneratedAvatarCacheCommand extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $output->writeln("clearing avatar cache started"); + $output->writeln("Clearing avatar cache has started"); $this->avatarManager->clearCachedAvatars(); - $output->writeln("cleared avatar cache successfully"); + $output->writeln("Cleared avatar cache successfully"); return 0; } } From 1d50d78bb3f596903e412966ab90868228bcf142 Mon Sep 17 00:00:00 2001 From: yemkareems Date: Tue, 16 Apr 2024 14:18:51 +0530 Subject: [PATCH 4/4] feat: changes by build/autoloaderchecker.sh Signed-off-by: yemkareems --- lib/composer/composer/autoload_classmap.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 526854bea77..0c2908773d5 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -1134,6 +1134,7 @@ return array( 'OC\\Core\\Command\\User\\AuthTokens\\Add' => $baseDir . '/core/Command/User/AuthTokens/Add.php', 'OC\\Core\\Command\\User\\AuthTokens\\Delete' => $baseDir . '/core/Command/User/AuthTokens/Delete.php', 'OC\\Core\\Command\\User\\AuthTokens\\ListCommand' => $baseDir . '/core/Command/User/AuthTokens/ListCommand.php', + 'OC\\Core\\Command\\User\\ClearGeneratedAvatarCacheCommand' => $baseDir . '/core/Command/User/ClearGeneratedAvatarCacheCommand.php', 'OC\\Core\\Command\\User\\Delete' => $baseDir . '/core/Command/User/Delete.php', 'OC\\Core\\Command\\User\\Disable' => $baseDir . '/core/Command/User/Disable.php', 'OC\\Core\\Command\\User\\Enable' => $baseDir . '/core/Command/User/Enable.php',