Merge branch 'w42_MDL-42243_m26_filtersettings' of https://github.com/skodak/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2013-10-13 23:19:18 +02:00
commit 04e49ead57
8 changed files with 17 additions and 2 deletions

View File

@ -1,6 +1,10 @@
This file describes API changes in core filter API and plugins,
information provided here is intended especially for developers.
=== 2.6 ===
* filtersettings.php is now deprecated, migrate to standard settings.php
=== 2.5 ===
* legacy_filter emulation was removed

View File

@ -71,13 +71,20 @@ class filter extends base {
return;
}
if (!$hassiteconfig or !file_exists($this->full_path('settings.php'))) {
if (!$hassiteconfig) {
return;
}
if (file_exists($this->full_path('settings.php'))) {
$fullpath = $this->full_path('settings.php');
} else if (file_exists($this->full_path('filtersettings.php'))) {
$fullpath = $this->full_path('filtersettings.php');
} else {
return;
}
$section = $this->get_settings_section_name();
$settings = new admin_settingpage($section, $this->displayname, 'moodle/site:config', $this->is_enabled() === false);
include($this->full_path('filtersettings.php')); // This may also set $settings to null.
include($fullpath); // This may also set $settings to null.
if ($settings) {
$ADMIN->add($parentnodename, $settings);

View File

@ -1124,6 +1124,10 @@ function filter_delete_all_for_context($contextid) {
*/
function filter_has_global_settings($filter) {
global $CFG;
$settingspath = $CFG->dirroot . '/filter/' . $filter . '/settings.php';
if (is_readable($settingspath)) {
return true;
}
$settingspath = $CFG->dirroot . '/filter/' . $filter . '/filtersettings.php';
return is_readable($settingspath);
}