(bug 13796) Show links to parent pages even if some of them are missing
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 20 Apr 2008 18:53:46 +0000 (18:53 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 20 Apr 2008 18:53:46 +0000 (18:53 +0000)
RELEASE-NOTES
includes/Skin.php

index 44e43c1..5e1ebcb 100644 (file)
@@ -207,6 +207,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   changeable or all unchangeable
 * Fix fatal error on calling PAGESINCATEGORY with invalid category name
 * (bug 13793) Special:Whatlinkshere filters wrong - after paginating instead of before
+* (bug 13796) Show links to parent pages even if some of them are missing
 
 === API changes in 1.13 ===
 
index 77b215c..0b9e3be 100644 (file)
@@ -888,22 +888,28 @@ END;
                        $ptext=$wgTitle->getPrefixedText();
                        if(preg_match('/\//',$ptext)) {
                                $links = explode('/',$ptext);
+                               array_pop( $links );
                                $c = 0;
                                $growinglink = '';
+                               $display = '';
                                foreach($links as $link) {
-                                       $c++;
-                                       if ($c<count($links)) {
-                                               $growinglink .= $link;
-                                               $getlink = $this->makeLink( $growinglink, htmlspecialchars( $link ) );
-                                               if(preg_match('/class="new"/i',$getlink)) { break; } # this is a hack, but it saves time
+                                       $growinglink .= $link;
+                                       $display .= $link;
+                                       $linkObj = Title::newFromText( $growinglink );
+                                       if( $linkObj->exists() ){
+                                               $getlink = $this->makeKnownLinkObj( $linkObj, htmlspecialchars( $display ) );
+                                               $c++;
                                                if ($c>1) {
                                                        $subpages .= ' | ';
                                                } else  {
                                                        $subpages .= '&lt; ';
                                                }
                                                $subpages .= $getlink;
-                                               $growinglink .= '/';
+                                               $display = '';
+                                       } else {
+                                               $display .= '/';
                                        }
+                                       $growinglink .= '/';
                                }
                        }
                }