Command/ModuleFixCommand.php
public function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;

        $verboseOutput = $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE
            ? $output
            : new NullOutput();

        try {
            $aModuleIds = $this->_parseModuleIds();
            $aShopConfigs = $this->_parseShopConfigs();
        } catch (InputException $oEx) {
            $output->writeLn($oEx->getMessage());
            exit(1);
        }

        /** @var ModuleStateFixer $oModuleStateFixer */
        $oModuleStateFixer = Registry::get(ModuleStateFixer::class);
        $oModuleStateFixer->setOutput($output);
        $oModuleStateFixer->setDebugOutput($verboseOutput);

        /** @var Module $oModule */
        $oModule = oxNew(Module::class);

        foreach ($aShopConfigs as $oConfig) {
            $moduleCount = count($aModuleIds);
            $verboseOutput->writeLn('[DEBUG] Working on shop id ' . $oConfig->getShopId() . " fixing $moduleCount modules");
            $oModuleStateFixer->setConfig($oConfig);
            $oModuleStateFixer->cleanUp();
            foreach ($aModuleIds as $sModuleId) {
                $oModule->setMetaDataVersion(null);
                if (!$oModule->load($sModuleId)) {
                    $verboseOutput->writeLn("[DEBUG] {$sModuleId} does not exist - skipping");
                    continue;
                }

                $verboseOutput->writeLn("[DEBUG] Fixing {$sModuleId} module");
                $oModuleStateFixer->fix($oModule);
            }

            $verboseOutput->writeLn('');
        }

        $output->writeLn('Fixed module states successfully');
    }
public function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;

        $verboseOutput = $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE
            ? $output
            : new NullOutput();

        try {
            $aModuleIds = $this->_parseModuleIds();
            $aShopConfigs = $this->_parseShopConfigs();
        } catch (InputException $oEx) {
            $output->writeLn($oEx->getMessage());
            exit(1);
        }

        /** @var ModuleStateFixer $oModuleStateFixer */
        $oModuleStateFixer = Registry::get(ModuleStateFixer::class);
        $oModuleStateFixer->setOutput($output);
        $oModuleStateFixer->setDebugOutput($verboseOutput);

        /** @var Module $oModule */
        $oModule = oxNew(Module::class);

        foreach ($aShopConfigs as $oConfig) {
            $moduleCount = count($aModuleIds);
            $verboseOutput->writeLn('[DEBUG] Working on shop id ' . $oConfig->getShopId() . " fixing $moduleCount modules");
            $oModuleStateFixer->setConfig($oConfig);
            $oModuleStateFixer->cleanUp();
            foreach ($aModuleIds as $sModuleId) {
                $oModule->setMetaDataVersion(null);
                if (!$oModule->load($sModuleId)) {
                    $verboseOutput->writeLn("[DEBUG] {$sModuleId} does not exist - skipping");
                    continue;
                }

                $verboseOutput->writeLn("[DEBUG] Fixing {$sModuleId} module");
                $oModuleStateFixer->fix($oModule);
            }

            $verboseOutput->writeLn('');
        }

        $output->writeLn('Fixed module states successfully');
    }
{@inheritdoc}