/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $bundles = $this->drupalApi->getBundles(); foreach ($bundles as $bundleType => $bundleName) { $key = sprintf($this->trans('commands.site.statistics.messages.node-type'), $bundleName); $statistics[$key] = $this->getNodeTypeCount($bundleType); } $statistics[$this->trans('commands.site.statistics.messages.comments')] = $this->getCommentCount(); $statistics[$this->trans('commands.site.statistics.messages.vocabulary')] = $this->getTaxonomyVocabularyCount(); $statistics[$this->trans('commands.site.statistics.messages.taxonomy-terms')] = $this->getTaxonomyTermCount(); $statistics[$this->trans('commands.site.statistics.messages.files')] = $this->getFileCount(); $statistics[$this->trans('commands.site.statistics.messages.users')] = $this->getUserCount(); $statistics[$this->trans('commands.site.statistics.messages.views')] = $this->getViewCount(); $statistics[$this->trans('commands.site.statistics.messages.modules-enabled')] = $this->getModuleCount(true); $statistics[$this->trans('commands.site.statistics.messages.modules-disabled')] = $this->getModuleCount(false); $statistics[$this->trans('commands.site.statistics.messages.themes-enabled')] = $this->getThemeCount(true); $statistics[$this->trans('commands.site.statistics.messages.themes-disabled')] = $this->getThemeCount(false); $this->statisticsList($io, $statistics); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $contentTypes = $input->getArgument('content-types'); $limit = $input->getOption('limit') ?: 25; $titleWords = $input->getOption('title-words') ?: 5; $timeRange = $input->getOption('time-range') ?: 31536000; $available_types = array_keys($this->drupalApi->getBundles()); foreach ($contentTypes as $type) { if (!in_array($type, $available_types)) { throw new \Exception('Invalid content type name given.'); } } if (!$contentTypes) { $contentTypes = $available_types; } $nodes = $this->createNodeData->create($contentTypes, $limit, $titleWords, $timeRange); $tableHeader = [$this->trans('commands.create.nodes.messages.node-id'), $this->trans('commands.create.nodes.messages.content-type'), $this->trans('commands.create.nodes.messages.title'), $this->trans('commands.create.nodes.messages.created')]; $io->table($tableHeader, $nodes['success']); $io->success(sprintf($this->trans('commands.create.nodes.messages.created-nodes'), $limit)); return 0; }