Index: trunk/phase3/includes/api/ApiQueryIWBacklinks.php |
— | — | @@ -40,14 +40,10 @@ |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function execute() { |
44 | | - $params = $this->extractRequestParams( false ); |
45 | | - |
46 | | - $userMax = ( $this->redirect ? ApiBase::LIMIT_BIG1 / 2 : ApiBase::LIMIT_BIG1 ); |
47 | | - $botMax = ( $this->redirect ? ApiBase::LIMIT_BIG2 / 2 : ApiBase::LIMIT_BIG2 ); |
48 | | - |
49 | | - if ( $params['limit'] == 'max' ) { |
50 | | - $params['limit'] = $this->getMain()->canApiHighLimits() ? $botMax : $userMax; |
51 | | - $this->getResult()->addValue( 'limits', $this->getModuleName(), $params['limit'] ); |
| 44 | + $params = $this->extractRequestParams(); |
| 45 | + |
| 46 | + if ( isset( $params['title'] ) && !isset( $params['prefix'] ) ) { |
| 47 | + $this->dieUsageMsg( array( 'missingparam', 'prefix' ) ); |
52 | 48 | } |
53 | 49 | |
54 | 50 | if ( !is_null( $params['continue'] ) ) { |
— | — | @@ -75,22 +71,19 @@ |
76 | 72 | $this->addFields( array( 'page_id', 'page_title', 'page_namespace', 'page_is_redirect', |
77 | 73 | 'iwl_from', 'iwl_prefix', 'iwl_title' ) ); |
78 | 74 | |
79 | | - if ( $params['prefix'] !== '' ) { |
| 75 | + if ( isset( $params['prefix'] ) ) { |
80 | 76 | $this->addWhereFld( 'iwl_prefix', $params['prefix'] ); |
81 | 77 | } |
82 | 78 | |
83 | | - if ( $params['title'] !== '' ) { |
| 79 | + if ( isset( $params['title'] ) ) { |
84 | 80 | $this->addWhereFld( 'iwl_title', $params['title'] ); |
85 | 81 | } |
86 | 82 | |
87 | | - $this->addWhereFld( 'page_namespace', $params['namespace'] ); |
88 | | - |
89 | 83 | $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
90 | 84 | $this->addOption( 'ORDER BY', 'iwl_from' ); |
91 | | - $this->addOption( 'STRAIGHT_JOIN' ); |
92 | 85 | |
93 | 86 | $db = $this->getDB(); |
94 | | - $res = $this->select( __METHOD__ . '::firstQuery' ); |
| 87 | + $res = $this->select( __METHOD__ ); |
95 | 88 | |
96 | 89 | $count = 0; |
97 | 90 | $result = $this->getResult(); |
— | — | @@ -131,10 +124,6 @@ |
132 | 125 | 'prefix' => null, |
133 | 126 | 'title' => null, |
134 | 127 | 'continue' => null, |
135 | | - 'namespace' => array( |
136 | | - ApiBase::PARAM_ISMULTI => true, |
137 | | - ApiBase::PARAM_TYPE => 'namespace' |
138 | | - ), |
139 | 128 | 'limit' => array( |
140 | 129 | ApiBase::PARAM_DFLT => 10, |
141 | 130 | ApiBase::PARAM_TYPE => 'limit', |
— | — | @@ -148,9 +137,8 @@ |
149 | 138 | public function getParamDescription() { |
150 | 139 | return array( |
151 | 140 | 'prefix' => 'Prefix for the interwiki', |
152 | | - 'title' => 'Interwiki link to search for', |
| 141 | + 'title' => "Interwiki link to search for. Must be used with {$this->getModulePrefix()}prefix", |
153 | 142 | 'continue' => 'When more results are available, use this to continue', |
154 | | - 'namespace' => 'The namespace to enumerate', |
155 | 143 | 'limit' => 'How many total pages to return', |
156 | 144 | ); |
157 | 145 | } |
— | — | @@ -165,17 +153,16 @@ |
166 | 154 | |
167 | 155 | public function getPossibleErrors() { |
168 | 156 | return array_merge( parent::getPossibleErrors(), array( |
169 | | - array( 'invalidtitle', 'title' ), |
170 | | - array( 'missingparam', 'title' ), |
| 157 | + array( 'missingparam', 'prefix' ), |
171 | 158 | array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ), |
172 | 159 | ) ); |
173 | 160 | } |
174 | 161 | |
175 | 162 | protected function getExamples() { |
176 | 163 | return array( |
177 | | - 'api.php?action=query&list=iwbacklinks&iwbltitle=Test&iwblprefix=wikibooks', |
178 | | - 'api.php?action=query&generator=iwbacklinks&giwbltitle=Test&iwblprefix=wikibooks&prop=info' |
179 | | - ); |
| 164 | + 'api.php?action=query&list=iwbacklinks&iwbltitle=Test&iwblprefix=wikibooks', |
| 165 | + 'api.php?action=query&generator=iwbacklinks&giwbltitle=Test&iwblprefix=wikibooks&prop=info' |
| 166 | + ); |
180 | 167 | } |
181 | 168 | |
182 | 169 | public function getVersion() { |