Skip to content

Commit

Permalink
MDL-43213 behat: Moving permissions setting before any use of them
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Dec 19, 2013
1 parent 9bb80d2 commit f46e869
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions lib/behat/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 14 additions & 14 deletions lib/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@
// 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.

Expand Down Expand Up @@ -331,20 +345,6 @@
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';
Expand Down

0 comments on commit f46e869

Please sign in to comment.