Skip to content
Permalink
Browse files

Fix [Drupal\Component\Plugin\Exception\PluginNotFoundException] error (

  • Loading branch information...
kabanon authored and LOBsTerr committed Oct 23, 2018
1 parent 912508f commit f79dab48cd76a3c186b6b540fade15468e906692
Showing with 31 additions and 7 deletions.
  1. +31 −7 src/Command/Site/StatisticsCommand.php
@@ -81,13 +81,16 @@ public function configure()
*/
protected function execute(InputInterface $input, OutputInterface $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);
if ($this->moduleHandler->moduleExists('node'))
{
$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();
@@ -136,6 +139,10 @@ private function getCommentCount()
*/
private function getTaxonomyVocabularyCount()
{
if (!$this->moduleHandler->moduleExists('taxonomy')) {
return 0;
}
$entityQuery = $this->entityQuery->get('taxonomy_vocabulary')->count();
$vocabularies = $entityQuery->execute();
@@ -147,6 +154,10 @@ private function getTaxonomyVocabularyCount()
*/
private function getTaxonomyTermCount()
{
if (!$this->moduleHandler->moduleExists('taxonomy')) {
return 0;
}
$entityQuery = $this->entityQuery->get('taxonomy_term')->count();
$terms = $entityQuery->execute();
@@ -158,6 +169,10 @@ private function getTaxonomyTermCount()
*/
private function getFileCount()
{
if (!$this->moduleHandler->moduleExists('file')) {
return 0;
}
$entityQuery = $this->entityQuery->get('file')->count();
$files = $entityQuery->execute();
@@ -169,6 +184,10 @@ private function getFileCount()
*/
private function getUserCount()
{
if (!$this->moduleHandler->moduleExists('user')) {
return 0;
}
$entityQuery = $this->entityQuery->get('user')->count();
$users = $entityQuery->execute();
@@ -206,6 +225,10 @@ private function getThemeCount($status = true)
*/
private function getViewCount($status = true, $tag = 'default')
{
if (!$this->moduleHandler->moduleExists('views')) {
return 0;
}
$entityQuery = $this->entityQuery->get('view')->condition('tag', 'default', '<>')->count();
$views = $entityQuery->execute();
@@ -233,3 +256,4 @@ private function statisticsList($statistics)
$this->getIo()->table($tableHeader, $tableRows);
}
}

0 comments on commit f79dab4

Please sign in to comment.
You can’t perform that action at this time.