From: Chad Horohoe Date: Wed, 16 Jul 2008 18:36:40 +0000 (+0000) Subject: Add $wgDefaultDirectoryChmod, allows customizing the default chmod value. Set to... X-Git-Tag: 1.31.0-rc.0~46478 X-Git-Url: http://git.cyclocoop.org//%22%22._DIR_PLUGIN_FULLCALENDAR.%22prive/themes/spip/images/event_edit.png/%22?a=commitdiff_plain;h=21a76ba1810475fdcb8b6cb222f189cdbd84a933;p=lhc%2Fweb%2Fwiklou.git Add $wgDefaultDirectoryChmod, allows customizing the default chmod value. Set to 0777 by default to keep current behavior. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index edf23cae6b..29e52321fa 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -162,6 +162,11 @@ $wgTmpDirectory = false; ///< defaults to "{$wgUploadDirectory}/tmp" $wgUploadBaseUrl = ""; /**@}*/ +/** + * Default value for chmoding of new directories. + */ +$wgDefaultDirectoryChmod = 0777; + /** * New file storage paths; currently used only for deleted files. * Set it like this: diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 56a313fa0f..8185a7fa5f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1709,12 +1709,22 @@ function wfTempDir() { /** * Make directory, and make all parent directories if they don't exist + * + * @param string $fullDir Full path to directory to create + * @param int $mode Chmod value to use, default is $wgDefaultDirectoryChmod + * @return bool */ -function wfMkdirParents( $fullDir, $mode = 0777 ) { +function wfMkdirParents( $fullDir, $mode = null ) { + global $wgDefaultDirectoryChmod; if( strval( $fullDir ) === '' ) return true; if( file_exists( $fullDir ) ) return true; + // If not defined or isn't an int, set to default + if ( !$mode || !is_int($mode) ) { + $mode = $wgDefaultDirectoryChmod; + } + # Go back through the paths to find the first directory that exists $currentDir = $fullDir;