mirror of
https://github.com/nextcloud/richdocuments.git
synced 2025-12-17 21:12:14 +01:00
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
|
|
namespace OCA\Richdocuments\Command;
|
|
|
|
use OCA\Richdocuments\TemplateManager;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
class UpdateEmptyTemplates extends Command {
|
|
/** @var TemplateManager */
|
|
private $templateManager;
|
|
|
|
public function __construct(TemplateManager $templateManager) {
|
|
$this->templateManager = $templateManager;
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function configure() {
|
|
$this
|
|
->setName('richdocuments:update-empty-templates')
|
|
->setDescription('Update empty template files');
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) {
|
|
try {
|
|
$this->templateManager->updateEmptyTemplates();
|
|
$output->writeln('<info>Empty template files were updated</info>');
|
|
return 0;
|
|
} catch (\Exception $e) {
|
|
$output->writeln('<error>Failed to update templates</error>');
|
|
$output->writeln($e->getMessage());
|
|
$output->writeln($e->getTraceAsString());
|
|
return 1;
|
|
}
|
|
}
|
|
}
|