Cleanup to r50310 & 50313: Don't use @ on chmod() and dl(), use wfSuppressWarnings...
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 19 May 2009 16:34:49 +0000 (16:34 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 19 May 2009 16:34:49 +0000 (16:34 +0000)
includes/diff/DifferenceEngine.php
includes/filerepo/FSRepo.php

index 343be24..152195b 100644 (file)
@@ -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' );
                }
        }
index 7a3a162..c0a50ef 100644 (file)
@@ -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();
+       }
 
 }