Merge pull request #927 from Flynsarmy/betterPluginCounts

Display active plugin count on updates page
This commit is contained in:
Samuel Georges 2015-02-21 14:58:29 +11:00
commit dc50c9fb67
3 changed files with 16 additions and 1 deletions

View File

@ -51,6 +51,7 @@ class Updates extends Controller
$this->vars['projectId'] = Parameters::get('system::project.id');
$this->vars['projectName'] = Parameters::get('system::project.name');
$this->vars['projectOwner'] = Parameters::get('system::project.owner');
$this->vars['pluginsActiveCount'] = PluginVersion::isEnabled()->count();
$this->vars['pluginsCount'] = PluginVersion::count();
return $this->asExtension('ListController')->index();
}

View File

@ -32,7 +32,11 @@
<?php endif ?>
<div class="scoreboard-item title-value">
<h4><?= e(trans('system::lang.updates.plugins')) ?></h4>
<p><?= $pluginsCount ?></p>
<?php if ( $pluginsCount == $pluginsActiveCount ): ?>
<p><?= $pluginsCount ?></p>
<?php else: ?>
<p><?= $pluginsActiveCount, ' (', $pluginsCount, ')' ?></p>
<?php endif; ?>
</div>
</div>
</div>

View File

@ -77,6 +77,16 @@ class PluginVersion extends Model
}
/**
* Only include enabled plugins
* @param $query
* @return mixed
*/
public function scopeIsEnabled($query)
{
return $query->where('is_disabled', '!=', 1);
}
/**
* Returns the current version for a plugin
* @param string $pluginCode Plugin code. Eg: Acme.Blog