From 09b9b3a92fab7e87af0fd872df8d32195df87738 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 24 Apr 2004 09:28:22 +0000 Subject: [PATCH] Fix category link display for unmade pages; it used to display every page in the database instead of just linking pages --- includes/Parser.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 4d42876313..6a39244396 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -276,14 +276,17 @@ class Parser $id = $this->mTitle->getArticleID() ; # For existing categories - $sql = "SELECT DISTINCT cur_title,cur_namespace FROM cur,links WHERE l_to={$id} AND l_from=cur_id"; - $res = wfQuery ( $sql, DB_READ ) ; - while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; - - # For non-existing categories - $sql = "SELECT DISTINCT cur_title,cur_namespace FROM cur,brokenlinks WHERE bl_to={$id} AND bl_from=cur_id" ; - $res = wfQuery ( $sql, DB_READ ) ; - while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; + if( $id ) { + $sql = "SELECT DISTINCT cur_title,cur_namespace FROM cur,links WHERE l_to={$id} AND l_from=cur_id"; + $res = wfQuery ( $sql, DB_READ ) ; + while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; + } else { + # For non-existing categories + $t = wfStrencode( $this->mTitle->getPrefixedDBKey() ); + $sql = "SELECT DISTINCT cur_title,cur_namespace FROM cur,brokenlinks WHERE bl_to='$t' AND bl_from=cur_id" ; + $res = wfQuery ( $sql, DB_READ ) ; + while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; + } # For all pages that link to this category foreach ( $data AS $x ) -- 2.20.1