From 1571a7c4c37dc9074a006264c33bc6dd9c3adcdc Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 8 May 2004 04:41:54 +0000 Subject: [PATCH] Suppress PHP warnings on failure to create thumbnail subdirectories. This should be checked at file save time and a human-friendly error message listed instead --- includes/GlobalFunctions.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index d78d263722..fd823d0b3a 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -430,12 +430,15 @@ function wfImageArchiveDir( $fname , $subdir="archive") $hash = md5( $fname ); $oldumask = umask(0); + + # Suppress warning messages here; if the file itself can't + # be written we'll worry about it then. $archive = "{$wgUploadDirectory}/{$subdir}"; - if ( ! is_dir( $archive ) ) { mkdir( $archive, 0777 ); } + if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); } $archive .= "/" . $hash{0}; - if ( ! is_dir( $archive ) ) { mkdir( $archive, 0777 ); } + if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); } $archive .= "/" . substr( $hash, 0, 2 ); - if ( ! is_dir( $archive ) ) { mkdir( $archive, 0777 ); } + if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); } umask( $oldumask ); return $archive; -- 2.20.1