MDL-43213 behat: Moving permissions setting before any use of them

This commit is contained in:
David Monllao 2013-12-19 13:47:46 +08:00
parent 9bb80d2005
commit f46e869ddf
2 changed files with 17 additions and 17 deletions

View File

@ -153,9 +153,9 @@ function behat_clean_init_config() {
$allowed = array_flip(array(
'wwwroot', 'dataroot', 'dirroot', 'admin', 'directorypermissions', 'filepermissions',
'dbtype', 'dblibrary', 'dbhost', 'dbname', 'dbuser', 'dbpass', 'prefix', 'dboptions',
'proxyhost', 'proxyport', 'proxytype', 'proxyuser', 'proxypassword', 'proxybypass',
'theme'
'umaskpermissions', 'dbtype', 'dblibrary', 'dbhost', 'dbname', 'dbuser', 'dbpass', 'prefix',
'dboptions', 'proxyhost', 'proxyport', 'proxytype', 'proxyuser', 'proxypassword',
'proxybypass', 'theme'
));
// Add extra allowed settings.

View File

@ -59,6 +59,20 @@ if (!isset($CFG)) {
// it can not be anything else, there is no point in having this in config.php
$CFG->dirroot = dirname(dirname(__FILE__));
// File permissions on created directories in the $CFG->dataroot
if (!isset($CFG->directorypermissions)) {
$CFG->directorypermissions = 02777; // Must be octal (that's why it's here)
}
if (!isset($CFG->filepermissions)) {
$CFG->filepermissions = ($CFG->directorypermissions & 0666); // strip execute flags
}
// Better also set default umask because developers often forget to include directory
// permissions in mkdir() and chmod() after creating new files.
if (!isset($CFG->umaskpermissions)) {
$CFG->umaskpermissions = (($CFG->directorypermissions & 0777) ^ 0777);
}
umask($CFG->umaskpermissions);
if (defined('BEHAT_SITE_RUNNING')) {
// We already switched to behat test site previously.
@ -331,20 +345,6 @@ if (!defined('AJAX_SCRIPT')) {
define('AJAX_SCRIPT', false);
}
// File permissions on created directories in the $CFG->dataroot
if (!isset($CFG->directorypermissions)) {
$CFG->directorypermissions = 02777; // Must be octal (that's why it's here)
}
if (!isset($CFG->filepermissions)) {
$CFG->filepermissions = ($CFG->directorypermissions & 0666); // strip execute flags
}
// Better also set default umask because developers often forget to include directory
// permissions in mkdir() and chmod() after creating new files.
if (!isset($CFG->umaskpermissions)) {
$CFG->umaskpermissions = (($CFG->directorypermissions & 0777) ^ 0777);
}
umask($CFG->umaskpermissions);
// Exact version of currently used yui2 and 3 library.
$CFG->yui2version = '2.9.0';
$CFG->yui3version = '3.13.0';