X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FArticle.php;h=ce6407ae965a0231ac9d7479dc2036f4908fcb8c;hb=2a4dfa169bd42eb7c68761155d44c450bcdc1423;hp=a6afd8e5966a56e35ed41cbcf47739bd2ef04c77;hpb=c62949f6973303eca66033753076f2f9699ff8a9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Article.php b/includes/Article.php index a6afd8e596..ce6407ae96 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -684,26 +684,15 @@ class Article implements Page { # Allow extensions do their own custom view for certain pages $outputDone = true; - } else { - $content = $this->getContentObject(); - $rt = $content ? $content->getRedirectChain() : null; - if ( $rt ) { - wfDebug( __METHOD__ . ": showing redirect=no page\n" ); - # Viewing a redirect page (e.g. with parameter redirect=no) - $outputPage->addHTML( $this->viewRedirect( $rt ) ); - # Parse just to get categories, displaytitle, etc. - $this->mParserOutput = $content->getParserOutput( $this->getTitle(), $oldid, $parserOptions, false ); - $outputPage->addParserOutputNoText( $this->mParserOutput ); - $outputDone = true; - } } break; case 4: # Run the parse, protected by a pool counter wfDebug( __METHOD__ . ": doing uncached parse\n" ); + $content = $this->getContentObject(); $poolArticleView = new PoolWorkArticleView( $this->getPage(), $parserOptions, - $this->getRevIdFetched(), $useParserCache, $this->getContentObject() ); + $this->getRevIdFetched(), $useParserCache, $content ); if ( !$poolArticleView->execute() ) { $error = $poolArticleView->getError(); @@ -722,6 +711,9 @@ class Article implements Page { $this->mParserOutput = $poolArticleView->getParserOutput(); $outputPage->addParserOutput( $this->mParserOutput ); + if ( $content->getRedirectTarget() ) { + $outputPage->addSubtitle( wfMessage( 'redirectpagesub' )->parse() ); + } # Don't cache a dirty ParserOutput object if ( $poolArticleView->getIsDirty() ) { @@ -989,9 +981,8 @@ class Article implements Page { // Set the fragment if one was specified in the redirect if ( strval( $this->getTitle()->getFragment() ) != '' ) { - $outputPage->addInlineScript( Xml::encodeJsCall( - 'redirectToFragment', array( $this->getTitle()->getFragmentForURL() ) - ) ); + $outputPage->addJsConfigVars( 'wgRedirectToFragment', $this->getTitle()->getFragmentForURL() ); + $outputPage->addModules( 'mediawiki.action.view.redirectToFragment' ); } // Add a tag @@ -1201,10 +1192,15 @@ class Article implements Page { wfRunHooks( 'ShowMissingArticle', array( $this ) ); + // Give extensions a chance to hide their (unrelated) log entries + $logTypes = array( 'delete', 'move' ); + $conds = array( "log_action != 'revision'" ); + wfRunHooks( 'Article::MissingArticleConditions', array( &$conds, $logTypes ) ); + # Show delete and move logs - LogEventsList::showLogExtract( $outputPage, array( 'delete', 'move' ), $this->getTitle(), '', + LogEventsList::showLogExtract( $outputPage, $logTypes, $this->getTitle(), '', array( 'lim' => 10, - 'conds' => array( "log_action != 'revision'" ), + 'conds' => $conds, 'showIfEmpty' => false, 'msgKey' => array( 'moveddeleted-notice' ) ) ); @@ -1415,7 +1411,10 @@ class Article implements Page { } /** - * View redirect + * Return the HTML for the top of a redirect page + * + * Chances are you should just be using the ParserOutput from + * WikitextContent::getParserOutput instead of calling this for redirects. * * @param $target Title|Array of destination(s) to redirect * @param $appendSubtitle Boolean [optional] @@ -1423,20 +1422,35 @@ class Article implements Page { * @return string containing HMTL with redirect link */ public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) { + $lang = $this->getTitle()->getPageLanguage(); + if ( $appendSubtitle ) { + $out = $this->getContext()->getOutput(); + $out->addSubtitle( wfMessage( 'redirectpagesub' )->parse() ); + } + return static::getRedirectHeaderHtml( $lang, $target, $forceKnown ); + } + + /** + * Return the HTML for the top of a redirect page + * + * Chances are you should just be using the ParserOutput from + * WikitextContent::getParserOutput instead of calling this for redirects. + * + * @since 1.23 + * @param Language $lang + * @param Title|array $target destination(s) to redirect + * @param bool $forceKnown Should the image be shown as a bluelink regardless of existence? + * @return string containing HMTL with redirect link + */ + public static function getRedirectHeaderHtml( Language $lang, $target, $forceKnown = false ) { global $wgStylePath; if ( !is_array( $target ) ) { $target = array( $target ); } - $lang = $this->getTitle()->getPageLanguage(); $imageDir = $lang->getDir(); - if ( $appendSubtitle ) { - $out = $this->getContext()->getOutput(); - $out->addSubtitle( wfMessage( 'redirectpagesub' )->escaped() ); - } - // the loop prepends the arrow image before the link, so the first case needs to be outside /** @@ -1547,8 +1561,8 @@ class Article implements Page { } if ( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'wpEditToken' ), - array( 'delete', $this->getTitle()->getPrefixedText() ) ) ) - { + array( 'delete', $this->getTitle()->getPrefixedText() ) ) + ) { # Flag to hide all contents of the archived revisions $suppress = $request->getVal( 'wpSuppress' ) && $user->isAllowed( 'suppressrevision' ); @@ -1606,6 +1620,10 @@ class Article implements Page { $outputPage->setPageTitle( wfMessage( 'delete-confirm', $this->getTitle()->getPrefixedText() ) ); $outputPage->addBacklinkSubtitle( $this->getTitle() ); $outputPage->setRobotPolicy( 'noindex,nofollow' ); + if ( $this->getTitle()->getBacklinkCache()->hasLinks( 'pagelinks' ) ) { + $outputPage->wrapWikiMsg( "\n", + 'deleting-backlinks-warning' ); + } $outputPage->addWikiMsg( 'confirmdeletetext' ); wfRunHooks( 'ArticleConfirmDelete', array( $this, $outputPage, &$reason ) );