Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

ClearGeneratedAvatarCacheCommand.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2024, Nextcloud GmbH
  4. *
  5. * @author Kareem <yemkareems@gmail.com>
  6. * @license AGPL-3.0-or-later
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OC\Core\Command\User;
  23. use OC\Avatar\AvatarManager;
  24. use OC\Core\Command\Base;
  25. use Symfony\Component\Console\Input\InputInterface;
  26. use Symfony\Component\Console\Output\OutputInterface;
  27. class ClearGeneratedAvatarCacheCommand extends Base {
  28. public function __construct(
  29. protected AvatarManager $avatarManager,
  30. ) {
  31. parent::__construct();
  32. }
  33. protected function configure(): void {
  34. $this
  35. ->setDescription('clear avatar cache')
  36. ->setName('user:clear-avatar-cache');
  37. }
  38. protected function execute(InputInterface $input, OutputInterface $output): int {
  39. $output->writeln("Clearing avatar cache has started");
  40. $this->avatarManager->clearCachedAvatars();
  41. $output->writeln("Cleared avatar cache successfully");
  42. return 0;
  43. }
  44. }