Cleanup to r50310 & 50313: Don't use @ on chmod() and dl(), use wfSuppressWarnings()/wfRestoreWarnings()

This commit is contained in:
Chad Horohoe 2009-05-19 16:34:49 +00:00
parent 9b3711e58b
commit 02e9f413eb
2 changed files with 19 additions and 5 deletions

View 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' );
}
}

View 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();
}
}