aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authoryemkareems <yemkareems@gmail.com>2024-04-16 15:13:32 +0530
committerGitHub <noreply@github.com>2024-04-16 15:13:32 +0530
commit29f044893701eced633fdbb0d10d4094e3e53073 (patch)
tree974a4a9844d45cd23e3051fdc2936f4186fc48e8 /core
parentfea0278947cafcd62877226dc5ddece04d596a98 (diff)
parent1d50d78bb3f596903e412966ab90868228bcf142 (diff)
downloadnextcloud-server-29f044893701eced633fdbb0d10d4094e3e53073.tar.gz
nextcloud-server-29f044893701eced633fdbb0d10d4094e3e53073.zip
Merge pull request #44840 from nextcloud/feature/occ-clear-avatar-cache-command
Feature/occ clear avatar cache command
Diffstat (limited to 'core')
-rw-r--r--core/Command/User/ClearGeneratedAvatarCacheCommand.php48
-rw-r--r--core/register_command.php1
2 files changed, 49 insertions, 0 deletions
diff --git a/core/Command/User/ClearGeneratedAvatarCacheCommand.php b/core/Command/User/ClearGeneratedAvatarCacheCommand.php
new file mode 100644
index 00000000000..69421846049
--- /dev/null
+++ b/core/Command/User/ClearGeneratedAvatarCacheCommand.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @copyright Copyright (c) 2024, Nextcloud GmbH
+ *
+ * @author Kareem <yemkareems@gmail.com>
+ * @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
+ * 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/>.
+ *
+ */
+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
+ ->setDescription('clear avatar cache')
+ ->setName('user:clear-avatar-cache');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ $output->writeln("Clearing avatar cache has 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));