Bartosz Dziewoński has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349490 )

Change subject: Ignore broken entries on Special:Categories
......................................................................

Ignore broken entries on Special:Categories

Ideally, we would just remove the broken entries from the database.
But that isn't trivial, as evidenced by the fact that this bug is
still not fixed. Let's do a workaround for now.

Bug: T99736
Change-Id: Ia3044fa1b6156f564f9a4453a0203607789b225d
---
M includes/specials/pagers/CategoryPager.php
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/90/349490/1

diff --git a/includes/specials/pagers/CategoryPager.php 
b/includes/specials/pagers/CategoryPager.php
index 7db90c1..c07e14e 100644
--- a/includes/specials/pagers/CategoryPager.php
+++ b/includes/specials/pagers/CategoryPager.php
@@ -74,7 +74,12 @@
                $this->mResult->rewind();
 
                foreach ( $this->mResult as $row ) {
-                       $batch->addObj( new TitleValue( NS_CATEGORY, 
$row->cat_title ) );
+                       try {
+                               // This try...catch should not be needed, but 
WMF wikis have broken entries (T99736)
+                               $batch->addObj( new TitleValue( NS_CATEGORY, 
$row->cat_title ) );
+                       } catch ( Wikimedia\Assert\ParameterAssertionException 
$ex ) {
+                               // Ignore
+                       }
                }
                $batch->execute();
                $this->mResult->rewind();
@@ -83,7 +88,12 @@
        }
 
        function formatRow( $result ) {
-               $title = new TitleValue( NS_CATEGORY, $result->cat_title );
+               try {
+                       // This try...catch should not be needed, but WMF wikis 
have broken entries (T99736)
+                       $title = new TitleValue( NS_CATEGORY, 
$result->cat_title );
+               } catch ( Wikimedia\Assert\ParameterAssertionException $ex ) {
+                       return "<!-- Broken entry (T99736): " . 
htmlspecialchars( $result->cat_title ) . " -->\n";
+               }
                $text = $title->getText();
                $link = $this->linkRenderer->makeLink( $title, $text );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/349490
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3044fa1b6156f564f9a4453a0203607789b225d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to