1
0

UpdateTheme.php 2.1 KB

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