UpdateTheme.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Core\Command\Maintenance;
  7. use OC\Core\Command\Maintenance\Mimetype\UpdateJS;
  8. use OCP\Files\IMimeTypeDetector;
  9. use OCP\ICacheFactory;
  10. use Symfony\Component\Console\Input\InputInterface;
  11. use Symfony\Component\Console\Output\OutputInterface;
  12. class UpdateTheme extends UpdateJS {
  13. public function __construct(
  14. IMimeTypeDetector $mimetypeDetector,
  15. protected ICacheFactory $cacheFactory,
  16. ) {
  17. parent::__construct($mimetypeDetector);
  18. }
  19. protected function configure() {
  20. $this
  21. ->setName('maintenance:theme:update')
  22. ->setDescription('Apply custom theme changes');
  23. }
  24. protected function execute(InputInterface $input, OutputInterface $output): int {
  25. // run mimetypelist.js update since themes might change mimetype icons
  26. parent::execute($input, $output);
  27. // cleanup image cache
  28. $c = $this->cacheFactory->createDistributed('imagePath');
  29. $c->clear('');
  30. $output->writeln('<info>Image cache cleared</info>');
  31. return 0;
  32. }
  33. }