From 02e9f413eb1e1bea3377bdd4710f5a15ea2dd92d Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 19 May 2009 16:34:49 +0000 Subject: [PATCH] Cleanup to r50310 & 50313: Don't use @ on chmod() and dl(), use wfSuppressWarnings()/wfRestoreWarnings() --- includes/diff/DifferenceEngine.php | 8 ++++++-- includes/filerepo/FSRepo.php | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 343be247e7..152195bfeb 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -625,12 +625,16 @@ CONTROL; global $wgExternalDiffEngine; if ( $wgExternalDiffEngine == 'wikidiff' && !function_exists( 'wikidiff_do_diff' ) ) { wfProfileIn( __METHOD__ . '-php_wikidiff.so' ); - @dl( 'php_wikidiff.so' ); + wfSuppressWarnings(); + dl( 'php_wikidiff.so' ); + wfRestoreWarnings(); wfProfileOut( __METHOD__ . '-php_wikidiff.so' ); } else if ( $wgExternalDiffEngine == 'wikidiff2' && !function_exists( 'wikidiff2_do_diff' ) ) { wfProfileIn( __METHOD__ . '-php_wikidiff2.so' ); - @dl( 'php_wikidiff2.so' ); + wfSuppressWarnings(); + dl( 'php_wikidiff2.so' ); + wfRestoreWarnings(); wfProfileOut( __METHOD__ . '-php_wikidiff2.so' ); } } diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index 7a3a1622a1..c0a50effd8 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -204,7 +204,7 @@ class FSRepo extends FileRepo { } } if ( $good ) { - @chmod( $dstPath, $this->fileMode ); + $this->chmod( $dstPath ); $status->successCount++; } else { $status->failCount++; @@ -390,7 +390,7 @@ class FSRepo extends FileRepo { $status->successCount++; wfDebug(__METHOD__.": wrote tempfile $srcPath to $dstPath\n"); // Thread-safe override for umask - @chmod( $dstPath, $this->fileMode ); + $this->chmod( $dstPath ); } else { $status->failCount++; } @@ -467,7 +467,7 @@ class FSRepo extends FileRepo { $status->error( 'filerenameerror', $srcPath, $archivePath ); $good = false; } else { - @chmod( $archivePath, $this->fileMode ); + $this->chmod( $archivePath ); } } if ( $good ) { @@ -561,5 +561,15 @@ class FSRepo extends FileRepo { } return strtr( $param, $this->simpleCleanPairs ); } + + /** + * Chmod a file, supressing the warnings. + * @param String $path The path to change + */ + protected function chmod( $path ) { + wfSuppressWarnings(); + chmod( $path, $this->fileMode ); + wfRestoreWarnings(); + } } -- 2.20.1