mirror of
https://github.com/moodle/moodle.git
synced 2025-03-13 20:26:32 +01:00
MDL-26955 get_plugin_directory() respects $CFG->themedir
If $CFG->themedir is set (it is not usually) and the given theme is not found in the standard location, then it is expected to be in the custom $CFG->themedir directory. Credit goes to Urs Hunkler for the idea of the patch.
This commit is contained in:
parent
b8df9414bd
commit
546b4bf59d
@ -6873,6 +6873,8 @@ function endecrypt ($pwd, $data, $case) {
|
||||
* @return string full path to plugin directory; NULL if not found
|
||||
*/
|
||||
function get_plugin_directory($plugintype, $name) {
|
||||
global $CFG;
|
||||
|
||||
if ($plugintype === '') {
|
||||
$plugintype = 'mod';
|
||||
}
|
||||
@ -6883,6 +6885,13 @@ function get_plugin_directory($plugintype, $name) {
|
||||
}
|
||||
$name = clean_param($name, PARAM_SAFEDIR); // just in case ;-)
|
||||
|
||||
if (!empty($CFG->themedir) and $plugintype === 'theme') {
|
||||
if (!is_dir($types['theme'] . '/' . $name)) {
|
||||
// ok, so the theme is supposed to be in the $CFG->themedir
|
||||
return $CFG->themedir . '/' . $name;
|
||||
}
|
||||
}
|
||||
|
||||
return $types[$plugintype].'/'.$name;
|
||||
}
|
||||
|
||||
@ -7079,7 +7088,7 @@ function get_plugin_types($fullpaths=true) {
|
||||
'qtype' => 'question/type',
|
||||
'qformat' => 'question/format',
|
||||
'plagiarism' => 'plagiarism',
|
||||
'theme' => 'theme'); // this is a bit hacky, themes may be in dataroot too
|
||||
'theme' => 'theme'); // this is a bit hacky, themes may be in $CFG->themedir too
|
||||
|
||||
$mods = get_plugin_list('mod');
|
||||
foreach ($mods as $mod => $moddir) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user