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:
+11
-2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user