+ * Returns Content object to use when the page does not exist.
+ *
+ * @return Content
+ */
+ private function getSubstituteContent() {
+ # If this is a MediaWiki:x message, then load the messages
+ # and return the message value for x.
+ if ( $this->getTitle()->getNamespace() == NS_MEDIAWIKI ) {
+ $text = $this->getTitle()->getDefaultMessageText();
+ if ( $text === false ) {
+ $text = '';
+ }
+
+ $content = ContentHandler::makeContent( $text, $this->getTitle() );
+ } else {
+ $message = $this->getContext()->getUser()->isLoggedIn() ? 'noarticletext' : 'noarticletextanon';
+ $content = new MessageContent( $message, null, 'parsemag' );
+ }
+
+ return $content;
+ }
+
+ /**
+ * Returns ParserOutput to use when a page does not exist. In some cases, we still want to show
+ * "virtual" content, e.g. in the MediaWiki namespace, or in the File namespace for non-local
+ * files.
+ *
+ * @param ParserOptions $options
+ *
+ * @return ParserOutput
+ */
+ protected function getEmptyPageParserOutput( ParserOptions $options ) {
+ $content = $this->getSubstituteContent();
+
+ return $content->getParserOutput( $this->getTitle(), 0, $options );
+ }
+
+ /**
+ * @see getOldIDFromRequest()
+ * @see getRevIdFetched()
+ *
+ * @return int The oldid of the article that is was requested in the constructor or via the
+ * context's WebRequest.