UpdateTheme.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Julius Härtl <jus@bitgrid.net>
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author Julius Härtl <jus@bitgrid.net>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OC\Core\Command\Maintenance;
  27. use OC\Core\Command\Maintenance\Mimetype\UpdateJS;
  28. use OCP\Files\IMimeTypeDetector;
  29. use OCP\ICacheFactory;
  30. use Symfony\Component\Console\Input\InputInterface;
  31. use Symfony\Component\Console\Output\OutputInterface;
  32. class UpdateTheme extends UpdateJS {
  33. protected IMimeTypeDetector $mimetypeDetector;
  34. protected ICacheFactory $cacheFactory;
  35. public function __construct(
  36. IMimeTypeDetector $mimetypeDetector,
  37. ICacheFactory $cacheFactory
  38. ) {
  39. parent::__construct($mimetypeDetector);
  40. $this->cacheFactory = $cacheFactory;
  41. }
  42. protected function configure() {
  43. $this
  44. ->setName('maintenance:theme:update')
  45. ->setDescription('Apply custom theme changes');
  46. }
  47. protected function execute(InputInterface $input, OutputInterface $output): int {
  48. // run mimetypelist.js update since themes might change mimetype icons
  49. parent::execute($input, $output);
  50. // cleanup image cache
  51. $c = $this->cacheFactory->createDistributed('imagePath');
  52. $c->clear('');
  53. $output->writeln('<info>Image cache cleared</info>');
  54. return 0;
  55. }
  56. }