UpdateTheme.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. public function __construct(
  34. IMimeTypeDetector $mimetypeDetector,
  35. protected ICacheFactory $cacheFactory,
  36. ) {
  37. parent::__construct($mimetypeDetector);
  38. }
  39. protected function configure() {
  40. $this
  41. ->setName('maintenance:theme:update')
  42. ->setDescription('Apply custom theme changes');
  43. }
  44. protected function execute(InputInterface $input, OutputInterface $output): int {
  45. // run mimetypelist.js update since themes might change mimetype icons
  46. parent::execute($input, $output);
  47. // cleanup image cache
  48. $c = $this->cacheFactory->createDistributed('imagePath');
  49. $c->clear('');
  50. $output->writeln('<info>Image cache cleared</info>');
  51. return 0;
  52. }
  53. }