if ( $oldid !== 0 ) {
# Load the given revision and check whether the page is another one.
# In that case, update this instance to reflect the change.
- $this->mRevision = Revision::newFromId( $oldid );
- if ( $this->mRevision !== null ) {
- // Revision title doesn't match the page title given?
- if ( $this->mPage->getID() != $this->mRevision->getPage() ) {
- $function = array( get_class( $this->mPage ), 'newFromID' );
- $this->mPage = call_user_func( $function, $this->mRevision->getPage() );
+ if ( $oldid === $this->mPage->getLatest() ) {
+ $this->mRevision = $this->mPage->getRevision();
+ } else {
+ $this->mRevision = Revision::newFromId( $oldid );
+ if ( $this->mRevision !== null ) {
+ // Revision title doesn't match the page title given?
+ if ( $this->mPage->getID() != $this->mRevision->getPage() ) {
+ $function = array( get_class( $this->mPage ), 'newFromID' );
+ $this->mPage = call_user_func( $function, $this->mRevision->getPage() );
+ }
}
}
}
'msgKey' => array( 'moveddeleted-notice' ) )
);
+ if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) {
+ // If there's no backing content, send a 404 Not Found
+ // for better machine handling of broken links.
+ $wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
+ }
+
+ $hookResult = wfRunHooks( 'BeforeDisplayNoArticleText', array( $this ) );
+
+ if ( ! $hookResult ) {
+ return;
+ }
+
# Show error message
$oldid = $this->getOldID();
if ( $oldid ) {
}
$text = "<div class='noarticletext'>\n$text\n</div>";
- if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) {
- // If there's no backing content, send a 404 Not Found
- // for better machine handling of broken links.
- $wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
- }
-
$wgOut->addWikiText( $text );
}
# Cascade unhide param in links for easy deletion browsing
$extraParams = array();
- if ( $wgRequest->getVal( 'unhide' ) ) {
+ if ( $unhide ) {
$extraParams['unhide'] = 1;
}
- $revision = Revision::newFromId( $oldid );
+ if ( $this->mRevision && $this->mRevision->getId() === $oldid ) {
+ $revision = $this->mRevision;
+ } else {
+ $revision = Revision::newFromId( $oldid );
+ }
+
$timestamp = $revision->getTimestamp();
$current = ( $oldid == $this->mPage->getLatest() );
/**
* Get parser options suitable for rendering the primary article wikitext
- * @return ParserOptions|bool
+ * @return ParserOptions
*/
public function getParserOptions() {
global $wgUser;
*
* @param $fname String Name of called method
* @param $args Array Arguments to the method
+ * @return mixed
*/
public function __call( $fname, $args ) {
if ( is_callable( array( $this->mPage, $fname ) ) ) {