Index: trunk/phase3/includes/api/ApiQueryCategories.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | return; // nothing to do |
55 | 55 | |
56 | 56 | $params = $this->extractRequestParams(); |
57 | | - $prop = $params['prop']; |
| 57 | + $prop = array_flip((array)$params['prop']); |
58 | 58 | $show = array_flip((array)$params['show']); |
59 | 59 | |
60 | 60 | $this->addFields(array ( |
— | — | @@ -61,23 +61,8 @@ |
62 | 62 | 'cl_to' |
63 | 63 | )); |
64 | 64 | |
65 | | - $fld_sortkey = $fld_timestamp = false; |
66 | | - if (!is_null($prop)) { |
67 | | - foreach($prop as $p) { |
68 | | - switch ($p) { |
69 | | - case 'sortkey': |
70 | | - $this->addFields('cl_sortkey'); |
71 | | - $fld_sortkey = true; |
72 | | - break; |
73 | | - case 'timestamp': |
74 | | - $this->addFields('cl_timestamp'); |
75 | | - $fld_timestamp = true; |
76 | | - break; |
77 | | - default : |
78 | | - ApiBase :: dieDebug(__METHOD__, "Unknown prop=$p"); |
79 | | - } |
80 | | - } |
81 | | - } |
| 65 | + $this->addFieldsIf('cl_sortkey', isset($prop['sortkey'])); |
| 66 | + $this->addFieldsIf('cl_timestamp', isset($prop['timestamp'])); |
82 | 67 | |
83 | 68 | $this->addTables('categorylinks'); |
84 | 69 | $this->addWhereFld('cl_from', array_keys($this->getPageSet()->getGoodTitles())); |
— | — | @@ -107,10 +92,11 @@ |
108 | 93 | } |
109 | 94 | if(isset($show['hidden']) && isset($show['!hidden'])) |
110 | 95 | $this->dieUsage("Incorrect parameter - mutually exclusive values may not be supplied", 'show'); |
111 | | - if(isset($show['hidden']) || isset($show['!hidden'])) |
| 96 | + if(isset($show['hidden']) || isset($show['!hidden']) || isset($prop['hidden'])) |
112 | 97 | { |
113 | 98 | $this->addOption('STRAIGHT_JOIN'); |
114 | 99 | $this->addTables(array('page', 'page_props')); |
| 100 | + $this->addFieldsIf('pp_propname', isset($prop['hidden'])); |
115 | 101 | $this->addJoinConds(array( |
116 | 102 | 'page' => array('LEFT JOIN', array( |
117 | 103 | 'page_namespace' => NS_CATEGORY, |
— | — | @@ -121,7 +107,7 @@ |
122 | 108 | )); |
123 | 109 | if(isset($show['hidden'])) |
124 | 110 | $this->addWhere(array('pp_propname IS NOT NULL')); |
125 | | - else |
| 111 | + else if(isset($show['!hidden'])) |
126 | 112 | $this->addWhere(array('pp_propname IS NULL')); |
127 | 113 | } |
128 | 114 | |
— | — | @@ -150,10 +136,12 @@ |
151 | 137 | $title = Title :: makeTitle(NS_CATEGORY, $row->cl_to); |
152 | 138 | $vals = array(); |
153 | 139 | ApiQueryBase :: addTitleInfo($vals, $title); |
154 | | - if ($fld_sortkey) |
| 140 | + if (isset($prop['sortkey'])) |
155 | 141 | $vals['sortkey'] = $row->cl_sortkey; |
156 | | - if ($fld_timestamp) |
| 142 | + if (isset($prop['timestamp'])) |
157 | 143 | $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->cl_timestamp); |
| 144 | + if (isset($prop['hidden']) && !is_null($row->pp_propname)) |
| 145 | + $vals['hidden'] = ''; |
158 | 146 | |
159 | 147 | $fit = $this->addPageSubItem($row->cl_from, $vals); |
160 | 148 | if(!$fit) |
— | — | @@ -190,6 +178,7 @@ |
191 | 179 | ApiBase :: PARAM_TYPE => array ( |
192 | 180 | 'sortkey', |
193 | 181 | 'timestamp', |
| 182 | + 'hidden', |
194 | 183 | ) |
195 | 184 | ), |
196 | 185 | 'show' => array( |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -133,6 +133,7 @@ |
134 | 134 | * (bug 18617) Add xml:space="preserve" attribute to relevant tags in XML output |
135 | 135 | * Added PHP and database version to meta=siteinfo output |
136 | 136 | * (bug 18533) Add readonly message to meta=siteinfo output |
| 137 | +* (bug 18518) Add clprop=hidden to prop=categories |
137 | 138 | |
138 | 139 | === Languages updated in 1.16 === |
139 | 140 | |