X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiParse.php;h=0cad5dee9ce0e79a2c4fda5070551cbd171325bc;hb=7c49c10d802445aa775a43144158ce867ebb9274;hp=83b5d93e615b15fb0610ccc3da822627e3201924;hpb=400dd985152b76f8a3365b1cdbdbec6bffb09c1e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 83b5d93e61..0cad5dee9c 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -641,6 +641,8 @@ class ApiParse extends ApiBase { $hiddencats[$row->page_title] = isset( $row->pp_propname ); } + $linkCache = LinkCache::singleton(); + foreach ( $links as $link => $sortkey ) { $entry = []; $entry['sortkey'] = $sortkey; @@ -648,6 +650,14 @@ class ApiParse extends ApiBase { ApiResult::setContentValue( $entry, 'category', (string)$link ); if ( !isset( $hiddencats[$link] ) ) { $entry['missing'] = true; + + // We already know the link doesn't exist in the database, so + // tell LinkCache that before calling $title->isKnown(). + $title = Title::makeTitle( NS_CATEGORY, $link ); + $linkCache->addBadLinkObj( $title ); + if ( $title->isKnown() ) { + $entry['known'] = true; + } } elseif ( $hiddencats[$link] ) { $entry['hidden'] = true; }