Skip to content

Commit 18b9784

Browse files
committed
Ignore Virtual Chamilo plugin-based portals
1 parent 8777935 commit 18b9784

7 files changed

+42
-7
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ a munin-run command and get results:
161161
If you got this, then it is likely all your scripts will start drawing charts
162162
in the next 5-10 minutes. Well done!
163163

164+
## Notes ##
165+
166+
The Virtual Chamilo plugin is not supported by this module. As such, if a portal using Virtual Chamilo is detected
167+
(by scanning ) for the corresponding lines in configuration.php, it will simply be ignored.
168+
164169
## Contact info ##
165170

166171
If you have any question, please use the "Issues" section.

get_connected_users_5_munin.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,14 @@ function get_connections($bd, $sub, $last_connect_minutes)
106106
// Chamilo 1.9
107107
$config_file = $bd.'/'.$dir.$sub.'/main/inc/conf/configuration.php';
108108
}
109-
if (!empty($config_file)) {
109+
if (!empty($config_file) && is_file($config_file) && is_readable($config_file)) {
110110
$_configuration = [];
111-
$inc = require_once($config_file);
111+
// Virtual Chamilo plugin not supported yet, skip such portals
112+
$configRaw = file_get_contents($config_file);
113+
if (preg_match('/Virtual::/', $configRaw)) {
114+
continue;
115+
}
116+
$inc = include_once($config_file);
112117
$dsn = 'mysql:dbname='.$_configuration['main_database'].';host='.$_configuration['db_host'];
113118
try {
114119
$dbh = new PDO($dsn, $_configuration['db_user'], $_configuration['db_password']);

get_live_answers_munin.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,13 @@ function get_connections($bd, $sub, $last_connect_minutes)
110110
// Chamilo 1.9
111111
$config_file = $bd.'/'.$dir.$sub.'/main/inc/conf/configuration.php';
112112
}
113-
if (!empty($config_file)) {
113+
if (!empty($config_file) && is_file($config_file) && is_readable($config_file)) {
114114
$_configuration = [];
115+
// Virtual Chamilo plugin not supported yet, skip such portals
116+
$configRaw = file_get_contents($config_file);
117+
if (preg_match('/Virtual::/', $configRaw)) {
118+
continue;
119+
}
115120
$inc = include_once($config_file);
116121
$dsn = 'mysql:dbname='.$_configuration['main_database'].';host='.$_configuration['db_host'];
117122
try {

get_live_exam_users_munin.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,13 @@ function get_connections($bd, $sub, $last_connect_minutes)
110110
// Chamilo 1.9
111111
$config_file = $bd.'/'.$dir.$sub.'/main/inc/conf/configuration.php';
112112
}
113-
if (!empty($config_file)) {
113+
if (!empty($config_file) && is_file($config_file) && is_readable($config_file)) {
114114
$_configuration = [];
115+
// Virtual Chamilo plugin not supported yet, skip such portals
116+
$configRaw = file_get_contents($config_file);
117+
if (preg_match('/Virtual::/', $configRaw)) {
118+
continue;
119+
}
115120
$inc = include_once($config_file);
116121
$dsn = 'mysql:dbname='.$_configuration['main_database'].';host='.$_configuration['db_host'];
117122
try {

get_registered_courses_munin.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ function get_courses($bd, $sub)
102102
// Chamilo 1.9
103103
$config_file = $bd.'/'.$dir.$sub.'/main/inc/conf/configuration.php';
104104
}
105-
if (!empty($config_file)) {
105+
if (!empty($config_file) && is_file($config_file) && is_readable($config_file)) {
106106
$_configuration = [];
107+
// Virtual Chamilo plugin not supported yet, skip such portals
108+
$configRaw = file_get_contents($config_file);
109+
if (preg_match('/Virtual::/', $configRaw)) {
110+
continue;
111+
}
107112
$inc = include_once($config_file);
108113
$dsn = 'mysql:dbname='.$_configuration['main_database'].';host='.$_configuration['db_host'];
109114
try {

get_registered_sessions_munin.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ function get_sessions($bd, $sub)
102102
// Chamilo 1.9
103103
$config_file = $bd.'/'.$dir.$sub.'/main/inc/conf/configuration.php';
104104
}
105-
if (!empty($config_file)) {
105+
if (!empty($config_file) && is_file($config_file) && is_readable($config_file)) {
106106
$_configuration = [];
107+
// Virtual Chamilo plugin not supported yet, skip such portals
108+
$configRaw = file_get_contents($config_file);
109+
if (preg_match('/Virtual::/', $configRaw)) {
110+
continue;
111+
}
107112
$inc = include_once($config_file);
108113
$dsn = 'mysql:dbname='.$_configuration['main_database'].';host='.$_configuration['db_host'];
109114
try {

get_registered_users_munin.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ function get_registrations($bd, $sub)
102102
// Chamilo 1.9
103103
$config_file = $bd.'/'.$dir.$sub.'/main/inc/conf/configuration.php';
104104
}
105-
if (!empty($config_file)) {
105+
if (!empty($config_file) && is_file($config_file) && is_readable($config_file)) {
106106
$_configuration = [];
107+
// Virtual Chamilo plugin not supported yet, skip such portals
108+
$configRaw = file_get_contents($config_file);
109+
if (preg_match('/Virtual::/', $configRaw)) {
110+
continue;
111+
}
107112
$inc = include_once($config_file);
108113
$dsn = 'mysql:dbname='.$_configuration['main_database'].';host='.$_configuration['db_host'];
109114
try {

0 commit comments

Comments
 (0)