From: Jens Frank Date: Mon, 14 Mar 2005 07:26:20 +0000 (+0000) Subject: @ considered evil X-Git-Tag: 1.5.0alpha1~612 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=8f28359a072e7a92536531e4b5edf393a05c84e7;p=lhc%2Fweb%2Fwiklou.git @ considered evil --- diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 194c9371e9..3045f7907e 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -299,8 +299,11 @@ class UploadForm { if( is_file( $this->mSavedFile ) ) { $this->mUploadOldVersion = gmdate( 'YmdHis' ) . "!{$saveName}"; + wfSuppressWarnings(); + $success = rename( $this->mSavedFile, "${archive}/{$this->mUploadOldVersion}" ); + wfRestoreWarnings(); - if( @!rename( $this->mSavedFile, "${archive}/{$this->mUploadOldVersion}" ) ) { + if( ! $success ) { $wgOut->fileRenameError( $this->mSavedFile, "${archive}/{$this->mUploadOldVersion}" ); return false; @@ -310,12 +313,20 @@ class UploadForm { } if( $useRename ) { - if( @!rename( $tempName, $this->mSavedFile ) ) { + wfSuppressWarnings(); + $success = rename( $tempName, $this->mSavedFile ); + wfRestoreWarnings(); + + if( ! $success ) ) { $wgOut->fileCopyError( $tempName, $this->mSavedFile ); return false; } } else { - if( @!move_uploaded_file( $tempName, $this->mSavedFile ) ) { + wfSuppressWarnings(); + $success = move_uploaded_file( $tempName, $this->mSavedFile ); + wfRestoreWarnings(); + + if( ! $success ) { $wgOut->fileCopyError( $tempName, $this->mSavedFile ); return false; } @@ -380,7 +391,10 @@ class UploadForm { * @access private */ function unsaveUploadedFile() { - if ( ! @unlink( $this->mUploadTempName ) ) { + wfSuppressWarnings(); + $success = unlink( $this->mUploadTempName ); + wfRestoreWarnings(); + if ( ! $success ) { $wgOut->fileDeleteError( $this->mUploadTempName ); } } @@ -640,7 +654,9 @@ class UploadForm { return true; } - $data = @getimagesize( $tmpfile ); + wfSuppressWarnings(); + $data = getimagesize( $tmpfile ); + wfRestoreWarnings(); if( false === $data ) { # Didn't recognize the image type. # Either the image is corrupt or someone's slipping us some