// to get the recentchanges row belonging to that entry
// (with rc_new = 1).
- // Check for cached results
- if ( $cache->get( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ) ) ) {
- return false;
- }
-
if ( $this->mRevision
&& !RecentChange::isInRCLifespan( $this->mRevision->getTimestamp(), 21600 )
) {
return false;
}
+ // Check for cached results
+ $key = wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() );
+ if ( $cache->get( $key ) ) {
+ return false;
+ }
+
$dbr = wfGetDB( DB_SLAVE );
$oldestRevisionTimestamp = $dbr->selectField(
'revision',
'rc_new' => 1,
'rc_timestamp' => $oldestRevisionTimestamp,
'rc_namespace' => $this->getTitle()->getNamespace(),
- 'rc_cur_id' => $this->getTitle()->getArticleID(),
- 'rc_patrolled' => 0
+ 'rc_cur_id' => $this->getTitle()->getArticleID()
),
__METHOD__,
array( 'USE INDEX' => 'new_name_timestamp' )
);
+ } else {
+ // Cache the information we gathered above in case we can't patrol
+ // Don't cache in case we can patrol as this could change
+ $cache->set( $key, '1' );
}
if ( !$rc ) {
- // No RC entry around
+ // Don't cache: This can be hit if the page gets accessed very fast after
+ // its creation or in case we have high slave lag. In case the revision is
+ // too old, we will already return above.
+ return false;
+ }
+
+ if ( $rc->getAttribute( 'rc_patrolled' ) ) {
+ // Patrolled RC entry around
// Cache the information we gathered above in case we can't patrol
// Don't cache in case we can patrol as this could change
- $cache->set( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ), '1' );
+ $cache->set( $key, '1' );
return false;
}
$text = wfMessage( 'noarticletext-nopermission' )->plain();
}
- $outputPage->addWikiText( "<div class='noarticletext'>\n$text\n</div>" );
+ $dir = $this->getContext()->getLanguage()->getDir();
+ $lang = $this->getContext()->getLanguage()->getCode();
+ $outputPage->addWikiText( Xml::openElement( 'div', array(
+ 'class' => "noarticletext mw-content-$dir",
+ 'dir' => $dir,
+ 'lang' => $lang,
+ ) ) . "\n$text\n</div>" );
}
}