$good = true;
if ( file_exists( $archivePath ) ) {
# A file with this content hash is already archived
- if ( !@unlink( $srcPath ) ) {
+ wfSuppressWarnings();
+ $good = unlink( $srcPath );
+ wfRestoreWarnings();
+ if ( !$good ) {
$status->error( 'filedeleteerror', $srcPath );
- $good = false;
}
} else{
- if ( !@rename( $srcPath, $archivePath ) ) {
+ wfSuppressWarnings();
+ $good = rename( $srcPath, $archivePath );
+ wfRestoreWarnings();
+ if ( !$good ) {
$status->error( 'filerenameerror', $srcPath, $archivePath );
- $good = false;
} else {
$this->chmod( $archivePath );
}
// Info we can get from API...
public function getWidth( $page = 1 ) {
- return intval( @$this->mInfo['width'] );
+ return isset( $this->mInfo['width'] ) ? intval( @$this->mInfo['width'] ) : 0;
}
public function getHeight( $page = 1 ) {
- return intval( @$this->mInfo['height'] );
+ return isset( $this->mInfo['height'] ) ? intval( @$this->mInfo['height'] ) : 0;
}
public function getMetadata() {
if ( strpos( $file, $this->getName() ) !== false ) {
$url = $this->getThumbUrl( $file );
$urls[] = $url;
- @unlink( "$dir/$file" );
+ wfSuppressWarnings();
+ unlink( "$dir/$file" );
+ wfRestoreWarnings();
}
}
}
if ( !$inuse ) {
wfDebug( __METHOD__ . ": deleting $key\n" );
- if ( !@unlink( $path ) ) {
+ wfSuppressWarnings();
+ $unlink = unlink( $path );
+ wfRestoreWarnings();
+ if ( !$unlink ) {
$status->error( 'undelete-cleanup-error', $path );
$status->failCount++;
}
// normaliseParams will inevitably give.
$xml = $image->getMetadata();
if ( !$xml ) {
- return new MediaTransformError( 'thumbnail_error', @$params['width'], @$params['height'],
+ $width = isset( $params['width'] ) ? $params['width'] : 0;
+ $height = isset( $params['height'] ) ? $params['height'] : 0;
+ return new MediaTransformError( 'thumbnail_error', $width, $height,
wfMsg( 'djvu_no_xml' ) );
}
<p id="userloginlink"><?php $this->html('link') ?></p>
<?php $this->html('header'); /* pre-table point for form plugins... */ ?>
<div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
- <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
+ <?php if( $this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
<table>
<tr>
<td class="mw-label"><label for='wpName1'><?php $this->msg('yourname') ?></label></td>
</td>
</tr>
</table>
-<?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
-<?php if( @$this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
+<?php if( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
+<?php if( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
</form>
</div>
<div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>
<h2><?php $this->msg('createaccount') ?></h2>
<p id="userloginlink"><?php $this->html('link') ?></p>
<?php $this->html('header'); /* pre-table point for form plugins... */ ?>
- <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
+ <?php if( $this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
<table>
<tr>
<td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
</td>
</tr>
</table>
-<?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
-<?php if( @$this->haveData( 'token' ) ) { ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
+<?php if( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
+<?php if( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
</form>
</div>
<div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>
return; // process only this path
} elseif ( $this->hasOption( 'list-file' ) ) {
$file = $this->getOption( 'list-file' );
- $f = @fopen( $file, 'r' );
+ wfSuppressWarnings();
+ $f = fopen( $file, 'r' );
+ wfRestoreWarnings();
if ( !$f ) {
$this->error( "Can't open file $file\n", true );
}
ob_start( array( &$cache, 'saveToFileCache' ) ); // save on ob_end_clean()
$wgUseFileCache = false; // hack, we don't want $article fiddling with filecache
$article->view();
- @$wgOut->output(); // header notices
+ wfSuppressWarnings(); // header notices
+ $wgOut->output();
+ wfRestoreWarnings();
$wgUseFileCache = true;
ob_end_clean(); // clear buffer
if ( $rebuilt )
# We can safely delete the file when we're done though.
$start = file_get_contents( 'searchUpdate.pos' );
unlink( 'searchUpdate.pos' );
+ } elseif( is_readable( $posFile ) ) {
+ $start = file_get_contents( $posFile );
} else {
- $start = @file_get_contents( $posFile );
- if ( !$start ) {
- $start = wfTimestamp( TS_MW, time() - 86400 );
- }
+ $start = wfTimestamp( TS_MW, time() - 86400 );
}
$lockTime = $this->getOption( 'l', 20 );
require_once( "$IP/includes/QueryPage.php" );
foreach ( $wgQueryPages as $page ) {
- @list( $class, $special, $limit ) = $page;
+ list( $class, $special ) = $page;
+ $limit = isset( $page[2] ) ? $page[2] : null;
# --list : just show the name of pages
if ( $this->hasOption( 'list' ) ) {