$this->mCacheHit = true;
// Check if the diff should be hidden from this user
if ( !$this->loadRevisionData() ) {
-
return false;
} elseif ( $this->mOldRev &&
!$this->mOldRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
) {
-
return false;
} elseif ( $this->mNewRev &&
!$this->mNewRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
) {
-
return false;
}
// Short-circuit
if ( $this->mOldRev === false || ( $this->mOldRev && $this->mNewRev
&& $this->mOldRev->getID() == $this->mNewRev->getID() )
) {
-
return '';
}
// Cacheable?
if ( !$this->mRefreshCache ) {
$difftext = $wgMemc->get( $key );
if ( $difftext ) {
- wfIncrStats( 'diff_cache_hit' );
+ wfIncrStats( 'diff_cache.hit' );
$difftext = $this->localiseLineNumbers( $difftext );
$difftext .= "\n<!-- diff cache key $key -->\n";
// Loadtext is permission safe, this just clears out the diff
if ( !$this->loadText() ) {
-
return false;
}
// Save to cache for 7 days
if ( !Hooks::run( 'AbortDiffCache', array( &$this ) ) ) {
- wfIncrStats( 'diff_uncacheable' );
+ wfIncrStats( 'diff_cache.uncacheable' );
} elseif ( $key !== false && $difftext !== false ) {
- wfIncrStats( 'diff_cache_miss' );
+ wfIncrStats( 'diff_cache.miss' );
$wgMemc->set( $key, $difftext, 7 * 86400 );
} else {
- wfIncrStats( 'diff_uncacheable' );
+ wfIncrStats( 'diff_cache.uncacheable' );
}
// Replace line numbers with the text in the user's language
if ( $difftext !== false ) {
$tempFile1 = fopen( $tempName1, "w" );
if ( !$tempFile1 ) {
-
return false;
}
$tempFile2 = fopen( $tempName2, "w" );
if ( !$tempFile2 ) {
-
return false;
}
fwrite( $tempFile1, $otext );
$key = $title->quickUserCan( 'edit', $user ) ? 'editold' : 'viewsourceold';
$msg = $this->msg( $key )->escaped();
$editLink = $this->msg( 'parentheses' )->rawParams(
- Linker::linkKnown( $title, $msg, array( ), $editQuery ) )->escaped();
+ Linker::linkKnown( $title, $msg, array(), $editQuery ) )->escaped();
$header .= ' ' . Html::rawElement(
'span',
array( 'class' => 'mw-diff-edit' ),