(bug 1922) When Special:Wantedpages is cached, mark links to pages which have since...
authorRob Church <robchurch@users.mediawiki.org>
Sat, 22 Apr 2006 02:36:54 +0000 (02:36 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 22 Apr 2006 02:36:54 +0000 (02:36 +0000)
RELEASE-NOTES
includes/SpecialWantedpages.php

index 97d7048..329f29b 100644 (file)
@@ -109,6 +109,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Fix linktrail for LanguageSr
 * (bug 5664) Fix Bosnian linktrail
 * (bug 3825) Namespace filtering on Special:Newpages
+* (bug 1922) When Special:Wantedpages is cached, mark links to pages
+  which have since been created
 
 == Compatibility ==
 
index f4a8f30..8d87869 100644 (file)
@@ -70,17 +70,42 @@ class WantedPagesPage extends QueryPage {
        function formatResult( $skin, $result ) {
                global $wgContLang;
 
-               $nt = Title::makeTitle( $result->namespace, $result->title );
-               $text = $wgContLang->convert( $nt->getPrefixedText() );
-               $plink = $this->isCached() ?
-                       $skin->makeLinkObj( $nt, $text ) :
-                       $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
-
-               $nl = wfMsg( 'nlinks', $result->value );
-               $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ), $nl, 'target=' . $nt->getPrefixedURL() );
-
-               return $this->nlinks ? "$plink ($nlink)" : $plink;
+               $title = Title::makeTitleSafe( $result->namespace, $result->title );
+
+               if( $this->isCached() ) {
+                       # Check existence; which is stored in the link cache
+                       if( !$title->exists() ) {
+                               # Make a redlink
+                               $pageLink = $skin->makeBrokenLinkObj( $title );
+                       } else {
+                               # Make a struck-out blue link
+                               $pageLink = "<s>" . $skin->makeKnownLinkObj( $title ) . "</s>";
+                       }               
+               } else {
+                       # Not cached? Don't bother checking existence; it can't
+                       $pageLink = $skin->makeBrokenLinkObj( $title );
+               }
+               
+               # Make a link to "what links here" if it's required
+               $wlhLink = $this->nlinks
+                                       ? " (" . $this->makeWlhLink( $title, $skin, wfMsgHtml( 'nlinks', $result->value ) ) . ")"
+                                       : "";
+                                       
+               return "{$pageLink}{$wlhLink}";
+       }
+       
+       /**
+        * Make a "what links here" link for a specified title
+        * @param $title Title to make the link for
+        * @param $skin Skin to use
+        * @param $text Link text
+        * @return string
+        */
+       function makeWlhLink( &$title, &$skin, $text ) {
+               $wlhTitle = Title::makeTitle( NS_SPECIAL, 'Whatlinkshere' );
+               return $skin->makeKnownLinkObj( $wlhTitle, $text, 'target=' . $title->getPrefixedUrl() );               
        }
+       
 }
 
 /**