-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add repair step to install default fonts on installation
Signed-off-by: Luka Trovic <[email protected]>
- Loading branch information
1 parent
3258d43
commit 1c2b935
Showing
7 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace OCA\Richdocuments\Command; | ||
|
||
use OCA\Richdocuments\Service\FontService; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class InstallDefaultFonts extends Command { | ||
public function __construct(private FontService $fontService) { | ||
parent::__construct(); | ||
} | ||
|
||
protected function configure() { | ||
$this | ||
->setName('richdocuments:install-fonts') | ||
->setDescription('Install default fonts'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) { | ||
try { | ||
$this->fontService->installDefaultFonts(); | ||
return 0; | ||
} catch (\Exception $e) { | ||
$output->writeln('<error>Failed to install default fonts</error>'); | ||
$output->writeln($e->getMessage()); | ||
$output->writeln($e->getTraceAsString()); | ||
return 1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace OCA\Richdocuments\Migration; | ||
|
||
use OCA\Richdocuments\Service\FontService; | ||
use OCP\IConfig; | ||
use OCP\Migration\IOutput; | ||
use OCP\Migration\IRepairStep; | ||
|
||
class InstallDefaultFonts implements IRepairStep { | ||
public function __construct(private IConfig $config, private FontService $fontService) { | ||
} | ||
|
||
public function getName(): string { | ||
return 'Install default fonts'; | ||
} | ||
|
||
public function run(IOutput $output): void { | ||
$appVersion = $this->config->getAppValue('richdocuments', 'installed_version'); | ||
|
||
if (version_compare($appVersion, '8.2.2') < 1) { | ||
return; | ||
} | ||
|
||
$this->fontService->installDefaultFonts(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters