$rdel = $this->revisionDeleteLink( $this->mNewRev );
# Allow extensions to define their own revision tools
- Hooks::run( 'DiffRevisionTools', array( $this->mNewRev, &$revisionTools, $this->mOldRev ) );
+ Hooks::run( 'DiffRevisionTools',
+ array( $this->mNewRev, &$revisionTools, $this->mOldRev, $user ) );
$formattedRevisionTools = array();
// Put each one in parentheses (poor man's button)
foreach ( $revisionTools as $key => $tool ) {
'rc_this_oldid' => $this->mNewid,
'rc_patrolled' => 0
),
- __METHOD__,
- array( 'USE INDEX' => 'rc_timestamp' )
+ __METHOD__
);
if ( $change && !$change->getPerformer()->equals( $user ) ) {
* @return mixed (string/false)
*/
public function getDiffBody() {
- global $wgMemc;
$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?
$key = false;
+ $cache = ObjectCache::getMainWANInstance();
if ( $this->mOldid && $this->mNewid ) {
$key = $this->getDiffBodyCacheKey();
// Try cache
if ( !$this->mRefreshCache ) {
- $difftext = $wgMemc->get( $key );
+ $difftext = $cache->get( $key );
if ( $difftext ) {
wfIncrStats( 'diff_cache.hit' );
$difftext = $this->localiseLineNumbers( $difftext );
// Loadtext is permission safe, this just clears out the diff
if ( !$this->loadText() ) {
-
return false;
}
wfIncrStats( 'diff_cache.uncacheable' );
} elseif ( $key !== false && $difftext !== false ) {
wfIncrStats( 'diff_cache.miss' );
- $wgMemc->set( $key, $difftext, 7 * 86400 );
+ $cache->set( $key, $difftext, 7 * 86400 );
} else {
wfIncrStats( 'diff_cache.uncacheable' );
}
$tempFile1 = fopen( $tempName1, "w" );
if ( !$tempFile1 ) {
-
return false;
}
$tempFile2 = fopen( $tempName2, "w" );
if ( !$tempFile2 ) {
-
return false;
}
fwrite( $tempFile1, $otext );