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\Controller\InstallerController
;
16 use Installer\Model\InstModuleTable
;
17 use Symfony\Component\Console\Command\Command
;
18 use Symfony\Component\Console\Input\InputDefinition
;
19 use Symfony\Component\Console\Input\InputInterface
;
20 use Symfony\Component\Console\Input\InputOption
;
21 use Symfony\Component\Console\Output\OutputInterface
;
23 class ZfcModule
extends Command
25 protected function configure(): void
28 ->setName('openemr:zfc-module')
29 ->setDescription('Module maintenance (install_sql, install_acl, upgrade_acl, upgrade_sql, install, enable, disable, unregister)')
30 ->addUsage('--site=default --modname=Multipledb --modaction=install')
33 new InputOption('modname', null, InputOption
::VALUE_REQUIRED
, 'Name of module'),
34 new InputOption('modaction', null, InputOption
::VALUE_REQUIRED
, 'Available actions: install_sql, install_acl, upgrade_acl, upgrade_sql, install, enable, disable, unregister'),
35 new InputOption('site', null, InputOption
::VALUE_REQUIRED
, 'Name of site', 'default'),
41 protected function execute(InputInterface
$input, OutputInterface
$output): int
43 if (empty($input->getOption('modname'))) {
44 $output->writeln('modname parameter is missing (required), so exiting');
47 if (empty($input->getOption('modaction'))) {
48 $output->writeln('modaction parameter is missing (required), so exiting');
52 $modname = $input->getOption('modname');
53 $modaction = $input->getOption('modaction');
54 (new InstallerController($GLOBALS['modules_application']->getServiceManager()->build(InstModuleTable
::class)))->commandInstallModuleAction($modname, $modaction);