r50777 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50776‎ | r50777 | r50778 >
Date:16:34, 19 May 2009
Author:demon
Status:ok
Tags:
Comment:
Cleanup to r50310 & 50313: Don't use @ on chmod() and dl(), use wfSuppressWarnings()/wfRestoreWarnings()
Modified paths:
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FSRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -625,12 +625,16 @@
626626 global $wgExternalDiffEngine;
627627 if ( $wgExternalDiffEngine == 'wikidiff' && !function_exists( 'wikidiff_do_diff' ) ) {
628628 wfProfileIn( __METHOD__ . '-php_wikidiff.so' );
629 - @dl( 'php_wikidiff.so' );
 629+ wfSuppressWarnings();
 630+ dl( 'php_wikidiff.so' );
 631+ wfRestoreWarnings();
630632 wfProfileOut( __METHOD__ . '-php_wikidiff.so' );
631633 }
632634 else if ( $wgExternalDiffEngine == 'wikidiff2' && !function_exists( 'wikidiff2_do_diff' ) ) {
633635 wfProfileIn( __METHOD__ . '-php_wikidiff2.so' );
634 - @dl( 'php_wikidiff2.so' );
 636+ wfSuppressWarnings();
 637+ dl( 'php_wikidiff2.so' );
 638+ wfRestoreWarnings();
635639 wfProfileOut( __METHOD__ . '-php_wikidiff2.so' );
636640 }
637641 }
Index: trunk/phase3/includes/filerepo/FSRepo.php
@@ -204,7 +204,7 @@
205205 }
206206 }
207207 if ( $good ) {
208 - @chmod( $dstPath, $this->fileMode );
 208+ $this->chmod( $dstPath );
209209 $status->successCount++;
210210 } else {
211211 $status->failCount++;
@@ -390,7 +390,7 @@
391391 $status->successCount++;
392392 wfDebug(__METHOD__.": wrote tempfile $srcPath to $dstPath\n");
393393 // Thread-safe override for umask
394 - @chmod( $dstPath, $this->fileMode );
 394+ $this->chmod( $dstPath );
395395 } else {
396396 $status->failCount++;
397397 }
@@ -467,7 +467,7 @@
468468 $status->error( 'filerenameerror', $srcPath, $archivePath );
469469 $good = false;
470470 } else {
471 - @chmod( $archivePath, $this->fileMode );
 471+ $this->chmod( $archivePath );
472472 }
473473 }
474474 if ( $good ) {
@@ -561,5 +561,15 @@
562562 }
563563 return strtr( $param, $this->simpleCleanPairs );
564564 }
 565+
 566+ /**
 567+ * Chmod a file, supressing the warnings.
 568+ * @param String $path The path to change
 569+ */
 570+ protected function chmod( $path ) {
 571+ wfSuppressWarnings();
 572+ chmod( $path, $this->fileMode );
 573+ wfRestoreWarnings();
 574+ }
565575
566576 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r50310(bug 16925) Diffs no longer silently fail when $wgExternalDiffEngine is set t...demon16:00, 7 May 2009

Status & tagging log