protected function enableModule($module, OutputInterface $output)
{
$decFile = $this->modulesDir . $module . '.xml';
if (!is_file($decFile)) {
$output->writeln('<error><comment>' . $module . ': </comment>Couldn\'t find declaration file</error>');
} elseif (!is_writable($decFile)) {
$output->writeln('<error><comment>' . $module . ': </comment>Can\'t write to declaration file</error>');
} else {
$xml = new \Varien_Simplexml_Element(file_get_contents($decFile));
$setTo = $this->commandName == 'enable' ? 'true' : 'false';
if ((string) $xml->modules->{$module}->active != $setTo) {
$xml->modules->{$module}->active = $setTo;
if (file_put_contents($decFile, $xml->asXML()) !== false) {
$output->writeln('<info><comment>' . $module . ': </comment>' . $this->commandName . 'd</info>');
} else {
$output->writeln('<error><comment>' . $module . ': </comment>Failed to update declaration file</error>');
}
} else {
$output->writeln('<info><comment>' . $module . ': already ' . $this->commandName . 'd</comment></info>');
}
}
}