Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless results cleaning #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,6 @@ public function render_tab_viewtable() {
ORDER BY count(pl.*) DESC, pl.frankenstyle ASC';
$result_plugins = $DB->get_records_sql($sql_plugins);

// Clean results from Moodle instances which have reported all plugins as installed which is simply not realistic
// but rather some strange webserver configuration.
$countfoundplugins = count($result_plugins);
foreach ($result_sitesplugins as $s) {
if ($s->count == $countfoundplugins) {
// Remove site entry from list of sites.
unset ($result_sitesplugins[$s->id]);
// Decrease plugin count in list of plugins.
foreach ($result_plugins as $p) {
$currentcount = $result_plugins[$p->id]->count;
if ($currentcount - 1 > 0) {
$result_plugins[$p->id]->count = $currentcount - 1;
} else {
unset($result_plugins[$p->id]);
}
}
}
}

// Build table heading.
$output .= \html_writer::tag('h3', get_string('table_pluginusedlabel', 'local_sitestats'));

Expand Down Expand Up @@ -315,25 +296,6 @@ public function render_tab_viewchart() {
ORDER BY count(pl.*) DESC, pl.frankenstyle ASC';
$result_plugins = $DB->get_records_sql($sql_plugins);

// Clean results from Moodle instances which have reported all plugins as installed which is simply not realistic
// but rather some strange webserver configuration.
$countfoundplugins = count($result_plugins);
foreach ($result_sites as $s) {
if ($s->count == $countfoundplugins) {
// Remove site entry from list of sites.
unset ($result_sites[$s->id]);
// Decrease plugin count in list of plugins.
foreach ($result_plugins as $p) {
$currentcount = $result_plugins[$p->id]->count;
if ($currentcount - 1 > 0) {
$result_plugins[$p->id]->count = $currentcount - 1;
} else {
unset($result_plugins[$p->id]);
}
}
}
}

// Pick the most used plugins.
$i = 0;
$mostusedpluginsabsolutedata = array();
Expand Down Expand Up @@ -502,25 +464,6 @@ public function render_tab_viewmetrics() {
ORDER BY count(pl.*) DESC, pl.frankenstyle ASC';
$result_plugins = $DB->get_records_sql($sql_plugins);

// Clean results from Moodle instances which have reported all plugins as installed which is simply not realistic
// but rather some strange webserver configuration.
$countfoundplugins = count($result_plugins);
foreach ($result_sites as $s) {
if ($s->count == $countfoundplugins) {
// Remove site entry from list of sites.
unset ($result_sites[$s->id]);
// Decrease plugin count in list of plugins.
foreach ($result_plugins as $p) {
$currentcount = $result_plugins[$p->id]->count;
if ($currentcount - 1 > 0) {
$result_plugins[$p->id]->count = $currentcount - 1;
} else {
unset($result_plugins[$p->id]);
}
}
}
}

// Get most plugins on a site.
$mostpluginsonasite = 0;
foreach ($result_sites as $site) {
Expand Down