/** * @see Console\Command\Command */ protected function execute(InputInterface $input, OutputInterface $output) { $module = $input->getArgument('module'); $modules = $this->moduleManager->getModules(); $path = "{$this->modulesDir}/{$module}-module"; if (isset($modules[$module])) { $output->writeln("<error>Module '{$module}' already exists.</error>"); return; } if (file_exists($path)) { $output->writeln("<error>Path '" . $path . "' exists.</error>"); return; } if (!is_writable(dirname($path))) { $output->writeln("<error>Path '" . dirname($path) . "' is not writable.</error>"); return; } umask(00); mkdir($path, 0777, TRUE); file_put_contents($path . '/Module.php', $this->getModuleFile($module)); file_put_contents($path . '/composer.json', $this->getComposerFile($module)); file_put_contents($path . '/readme.md', $this->getReadmeFile($module)); mkdir($path . '/Resources/config', 0777, TRUE); mkdir($path . '/Resources/public', 0777, TRUE); mkdir($path . '/Resources/translations', 0777, TRUE); mkdir($path . '/Resources/layouts', 0777, TRUE); mkdir($path . '/' . ucfirst($module) . 'Module', 0777, TRUE); }
/** * @return array */ protected function getModules() { $ret = array(); foreach ($this->moduleManager->getModules() as $name => $module) { $ret[$name] = '@' . $name . 'Module'; } return $ret; }
/** * @secured(privilege="show") */ public function actionDefault() { $this->template->modules = $this->moduleManager->getModules(); $this->template->hiddenModules = $this->hiddenModules; }