Index: trunk/phase3/includes/api/ApiQueryIWBacklinks.php |
— | — | @@ -64,6 +64,10 @@ |
65 | 65 | "iwl_from >= $from)))" |
66 | 66 | ); |
67 | 67 | } |
| 68 | + |
| 69 | + $prop = array_flip( $params['prop'] ); |
| 70 | + $iwprefix = isset( $prop['iwprefix'] ); |
| 71 | + $iwtitle = isset( $prop['iwtitle'] ); |
68 | 72 | |
69 | 73 | $this->addTables( array( 'iwlinks', 'page' ) ); |
70 | 74 | $this->addWhere( 'iwl_from = page_id' ); |
— | — | @@ -107,6 +111,14 @@ |
108 | 112 | if ( $row->page_is_redirect ) { |
109 | 113 | $entry['redirect'] = ''; |
110 | 114 | } |
| 115 | + |
| 116 | + if ( $iwprefix ) { |
| 117 | + $entry['iwprefix'] = $row->iwl_prefix; |
| 118 | + } |
| 119 | + |
| 120 | + if ( $iwtitle ) { |
| 121 | + $entry['iwtitle'] = $row->iwl_title; |
| 122 | + } |
111 | 123 | |
112 | 124 | $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $entry ); |
113 | 125 | if ( !$fit ) { |
— | — | @@ -132,7 +144,15 @@ |
133 | 145 | ApiBase::PARAM_MIN => 1, |
134 | 146 | ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, |
135 | 147 | ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 |
136 | | - ) |
| 148 | + ), |
| 149 | + 'prop' => array( |
| 150 | + ApiBase::PARAM_ISMULTI => true, |
| 151 | + ApiBase::PARAM_DFLT => '', |
| 152 | + ApiBase::PARAM_TYPE => array( |
| 153 | + 'iwprefix', |
| 154 | + 'iwtitle', |
| 155 | + ), |
| 156 | + ), |
137 | 157 | ); |
138 | 158 | } |
139 | 159 | |
— | — | @@ -141,6 +161,11 @@ |
142 | 162 | 'prefix' => 'Prefix for the interwiki', |
143 | 163 | 'title' => "Interwiki link to search for. Must be used with {$this->getModulePrefix()}prefix", |
144 | 164 | 'continue' => 'When more results are available, use this to continue', |
| 165 | + 'prop' => array( |
| 166 | + 'Which properties to get', |
| 167 | + ' iwprefix - Adds the prefix of the interwiki', |
| 168 | + ' iwtitle - Adds the title of the interwiki', |
| 169 | + ), |
145 | 170 | 'limit' => 'How many total pages to return', |
146 | 171 | ); |
147 | 172 | } |
— | — | @@ -163,7 +188,7 @@ |
164 | 189 | protected function getExamples() { |
165 | 190 | return array( |
166 | 191 | 'api.php?action=query&list=iwbacklinks&iwbltitle=Test&iwblprefix=wikibooks', |
167 | | - 'api.php?action=query&generator=iwbacklinks&giwbltitle=Test&iwblprefix=wikibooks&prop=info' |
| 192 | + //'api.php?action=query&generator=iwbacklinks&giwbltitle=Test&iwblprefix=wikibooks&prop=info' |
168 | 193 | ); |
169 | 194 | } |
170 | 195 | |