mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-22546 improving dir creation handling and improving dataroot support in config only scripts; using 02777 as default in lib/setup.php to match the default in config-dist.php
This commit is contained in:
parent
173ba4f1ca
commit
4cee2155b2
2 changed files with 12 additions and 11 deletions
|
@ -9239,8 +9239,9 @@ function remove_dir($dir, $content_only=false) {
|
|||
function check_dir_exists($dir, $create=false, $recursive=false) {
|
||||
global $CFG;
|
||||
|
||||
if (strstr(cleardoubleslashes($dir), cleardoubleslashes($CFG->dataroot.'/')) === false) {
|
||||
if (strpos(str_replace('\\', '/', $dir), str_replace('\\', '/', $CFG->dataroot.'/')) !== 0) {
|
||||
debugging('Warning. Wrong call to check_dir_exists(). $dir must be an absolute path under $CFG->dataroot ("' . $dir . '" is incorrect)', DEBUG_DEVELOPER);
|
||||
return false;
|
||||
}
|
||||
|
||||
$status = true;
|
||||
|
|
|
@ -108,6 +108,16 @@ if (!defined('AJAX_SCRIPT')) {
|
|||
define('AJAX_SCRIPT', false);
|
||||
}
|
||||
|
||||
// File permissions on created directories in the $CFG->dataroot
|
||||
if (empty($CFG->directorypermissions)) {
|
||||
$CFG->directorypermissions = 02777; // Must be octal (that's why it's here)
|
||||
}
|
||||
if (empty($CFG->filepermissions)) {
|
||||
$CFG->filepermissions = ($CFG->directorypermissions & 0666); // strip execute flags
|
||||
}
|
||||
// better also set default umask because recursive mkdir() does not apply permissions recursively otherwise
|
||||
umask(0000);
|
||||
|
||||
// exact version of currently used yui2 and 3 library
|
||||
$CFG->yui2version = '2.8.1';
|
||||
$CFG->yui3version = '3.1.1';
|
||||
|
@ -476,16 +486,6 @@ if (!empty($CFG->cachetype)) {
|
|||
$CFG->rcache = false;
|
||||
}
|
||||
|
||||
// File permissions on created directories in the $CFG->dataroot
|
||||
if (empty($CFG->directorypermissions)) {
|
||||
$CFG->directorypermissions = 0777; // Must be octal (that's why it's here)
|
||||
}
|
||||
if (empty($CFG->filepermissions)) {
|
||||
$CFG->filepermissions = ($CFG->directorypermissions & 0666); // strip execute flags
|
||||
}
|
||||
// better also set default umask because recursive mkdir() does not apply permissions recursively otherwise
|
||||
umask(0000);
|
||||
|
||||
// Calculate and set $CFG->ostype to be used everywhere. Possible values are:
|
||||
// - WINDOWS: for any Windows flavour.
|
||||
// - UNIX: for the rest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue