Skip to content

Commit a22d3f3

Browse files
committed
Search for all settings in config_plugins
1 parent 173f062 commit a22d3f3

File tree

1 file changed

+31
-0
lines changed
  • cleaner/environment_matrix/classes/local

1 file changed

+31
-0
lines changed

cleaner/environment_matrix/classes/local/matrix.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public static function environmentbar_exists() {
6969
* @return array
7070
*/
7171
public static function search($search, $configitems = []) {
72+
global $DB;
7273
$result = [];
7374

7475
$adminroot = admin_get_root();
@@ -117,6 +118,36 @@ public static function search($search, $configitems = []) {
117118

118119
}
119120

121+
$likeplugin = $DB->sql_like('plugin', ':likeplugin');
122+
$likename = $DB->sql_like('name', ':likename');
123+
$notlikename = $DB->sql_like('name', ':notlikename', true, true, true);
124+
$likevalue = $DB->sql_like('value', ':likevalue');
125+
$nontreefindings = $DB->get_records_sql(
126+
"SELECT *
127+
FROM {config_plugins}
128+
WHERE ({$likeplugin}
129+
OR {$likename}
130+
OR {$likevalue})
131+
AND $notlikename",
132+
[
133+
'likeplugin' => $search,
134+
'likename' => $search,
135+
'likevalue' => $search,
136+
'notlikename' => 'version',
137+
]
138+
);
139+
140+
foreach ($nontreefindings as $setting) {
141+
$record = new stdClass();
142+
$record->plugin = (empty($setting->plugin) ? 'core' : $setting->plugin);
143+
$record->value = get_config($record->plugin, $setting->name);
144+
$record->name = $setting->name;
145+
$record->textarea = false;
146+
$record->display = true;
147+
148+
$result[$record->plugin][$record->name] = $record;
149+
}
150+
120151
return $result;
121152
}
122153

0 commit comments

Comments
 (0)