jenkins-bot has submitted this change and it was merged.
Change subject: API: Have action=parse indicate hidden categories
......................................................................
API: Have action=parse indicate hidden categories
Also whether the category page exists, since we can get that basically
for free along with the 'hidden' flag.
Bug: 54884
Change-Id: I5c435f04b1b3b65c4153dea1767d48b49ed427c2
---
M RELEASE-NOTES-1.23
M includes/api/ApiParse.php
2 files changed, 31 insertions(+), 0 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
Parent5446: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index c9b56b9..804ea43 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -26,6 +26,8 @@
acting as if the latest revision was being viewed.
=== API changes in 1.23 ===
+* (bug 54884) action=parse&prop=categories now indicates hidden and missing
+ categories.
=== Languages updated in 1.23===
diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php
index a369994..301affb 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -461,12 +461,41 @@
private function formatCategoryLinks( $links ) {
$result = array();
+
+ if ( !$links ) {
+ return $result;
+ }
+
+ // Fetch hiddencat property
+ $lb = new LinkBatch;
+ $lb->setArray( array( NS_CATEGORY => $links ) );
+ $db = $this->getDB();
+ $res = $db->select( array( 'page', 'page_props' ),
+ array( 'page_title', 'pp_propname' ),
+ $lb->constructSet( 'page', $db ),
+ __METHOD__,
+ array(),
+ array( 'page_props' => array(
+ 'LEFT JOIN', array( 'pp_propname' =>
'hiddencat', 'pp_page = page_id' )
+ ) )
+ );
+ $hiddencats = array();
+ foreach ( $res as $row ) {
+ $hiddencats[$row->page_title] = isset(
$row->pp_propname );
+ }
+
foreach ( $links as $link => $sortkey ) {
$entry = array();
$entry['sortkey'] = $sortkey;
ApiResult::setContent( $entry, $link );
+ if ( !isset( $hiddencats[$link] ) ) {
+ $entry['missing'] = '';
+ } elseif ( $hiddencats[$link] ) {
+ $entry['hidden'] = '';
+ }
$result[] = $entry;
}
+
return $result;
}
--
To view, visit https://gerrit.wikimedia.org/r/87187
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5c435f04b1b3b65c4153dea1767d48b49ed427c2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits