Live hack: Skip some work on empty category/link sets
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 2 Apr 2006 03:59:07 +0000 (03:59 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 2 Apr 2006 03:59:07 +0000 (03:59 +0000)
includes/OutputPage.php

index b8ab62e..fa8c2fa 100644 (file)
@@ -217,6 +217,9 @@ class OutputPage {
        function addCategoryLinks($categories) {
                global $wgUser, $wgContLang;
 
+               if ( !is_array( $categories ) ) {
+                       return;
+               }
                # Add the links to the link cache in a batch
                $arr = array( NS_CATEGORY => $categories );
                $lb = new LinkBatch;
@@ -901,6 +904,9 @@ class OutputPage {
                $this->addKeyword( $wgTitle->getPrefixedText() );
                $count = 1;
                $links2d =& $parserOutput->getLinks();
+               if ( !is_array( $links2d ) ) {
+                       return;
+               }
                foreach ( $links2d as $ns => $dbkeys ) {
                        foreach( $dbkeys as $dbkey => $id ) {
                                $this->addKeyword( $dbkey );