From 21a76ba1810475fdcb8b6cb222f189cdbd84a933 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 16 Jul 2008 18:36:40 +0000 Subject: [PATCH] Add $wgDefaultDirectoryChmod, allows customizing the default chmod value. Set to 0777 by default to keep current behavior. --- includes/DefaultSettings.php | 5 +++++ includes/GlobalFunctions.php | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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; -- 2.20.1