7 * @link https://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2022 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 namespace OpenEMR\Common\Command
;
15 use Installer\Model\InstModuleTable
;
16 use Symfony\Component\Console\Command\Command
;
17 use Symfony\Component\Console\Input\InputDefinition
;
18 use Symfony\Component\Console\Input\InputInterface
;
19 use Symfony\Component\Console\Input\InputOption
;
20 use Symfony\Component\Console\Output\OutputInterface
;
22 class Register
extends Command
24 protected function configure(): void
27 ->setName('openemr:register')
28 ->setDescription('Register a zend module')
29 ->addUsage('--site=default --mtype=zend --modname=Multipledb')
32 new InputOption('mtype', null, InputOption
::VALUE_REQUIRED
, 'Only "zend" is supported'),
33 new InputOption('modname', null, InputOption
::VALUE_REQUIRED
, 'Zend module name'),
34 new InputOption('site', null, InputOption
::VALUE_REQUIRED
, 'Name of site', 'default'),
40 protected function execute(InputInterface
$input, OutputInterface
$output): int
42 if (empty($input->getOption('mtype'))) {
43 $output->writeln('mtype parameter is missing (required), so exiting');
46 if (empty($input->getOption('modname'))) {
47 $output->writeln('modname parameter is missing (required), so exiting');
51 if ($input->getOption('mtype') != 'zend') {
52 $output->writeln('mtype parameter that is not "zend" is not supported');
57 $moduleName = $input->getOption('modname');
58 $rel_path = "public/" . $moduleName . "/";
60 if ($GLOBALS['modules_application']->getServiceManager()->build(InstModuleTable
::class)->register($moduleName, $rel_path, 0, $GLOBALS['zendModDir'])) {
61 $output->writeln('Success');
64 $output->writeln('Failure');