MDL-41593 admin: use default setting if preventexecpath active

This resolves problems when installing Moodle
and addons when preventexecpath active.

Please note the admin_setting_configfile is still
incorrectly restricted - this will be resolved by
MDL-40949.
This commit is contained in:
Petr Skoda
2014-10-07 11:30:32 +13:00
parent 29507f2816
commit e22af76803
2 changed files with 64 additions and 2 deletions
+11 -2
View File
@@ -2434,13 +2434,22 @@ class admin_setting_configfile extends admin_setting_configtext {
'<div class="form-file defaultsnext"><input type="text" size="'.$this->size.'" id="'.$this->get_id().'" name="'.$this->get_full_name().'" value="'.s($data).'" />'.$executable.'</div>',
$this->description, true, '', $default, $query);
}
/**
* checks if execpatch has been disabled in config.php
* Checks if execpatch has been disabled in config.php
*/
public function write_setting($data) {
global $CFG;
if (!empty($CFG->preventexecpath)) {
return '';
if ($this->get_setting() === null) {
// Use default during installation.
$data = $this->get_defaultsetting();
if ($data === null) {
$data = '';
}
} else {
return '';
}
}
return parent::write_setting($data);
}