Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -149,17 +149,20 @@ |
150 | 150 | $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) ); |
151 | 151 | $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) ); |
152 | 152 | $this->addWhereIf( 'page_is_redirect = 1', isset ( $show['redirect'] ) ); |
| 153 | + |
153 | 154 | // Don't throw log entries out the window here |
154 | 155 | $this->addWhereIf( 'page_is_redirect = 0 OR page_is_redirect IS NULL', isset ( $show['!redirect'] ) ); |
155 | 156 | } |
156 | 157 | |
157 | 158 | if ( !is_null( $params['user'] ) && !is_null( $param['excludeuser'] ) ) |
158 | 159 | $this->dieUsage( 'user and excludeuser cannot be used together', 'user-excludeuser' ); |
| 160 | + |
159 | 161 | if ( !is_null( $params['user'] ) ) |
160 | 162 | { |
161 | 163 | $this->addWhereFld( 'rc_user_text', $params['user'] ); |
162 | 164 | $index = 'rc_user_text'; |
163 | 165 | } |
| 166 | + |
164 | 167 | if ( !is_null( $params['excludeuser'] ) ) |
165 | 168 | // We don't use the rc_user_text index here because |
166 | 169 | // * it would require us to sort by rc_user_text before rc_timestamp |
— | — | @@ -284,12 +287,23 @@ |
285 | 288 | |
286 | 289 | /* Determine what kind of change this was. */ |
287 | 290 | switch ( $type ) { |
288 | | - case RC_EDIT: $vals['type'] = 'edit'; break; |
289 | | - case RC_NEW: $vals['type'] = 'new'; break; |
290 | | - case RC_MOVE: $vals['type'] = 'move'; break; |
291 | | - case RC_LOG: $vals['type'] = 'log'; break; |
292 | | - case RC_MOVE_OVER_REDIRECT: $vals['type'] = 'move over redirect'; break; |
293 | | - default: $vals['type'] = $type; |
| 291 | + case RC_EDIT: |
| 292 | + $vals['type'] = 'edit'; |
| 293 | + break; |
| 294 | + case RC_NEW: |
| 295 | + $vals['type'] = 'new'; |
| 296 | + break; |
| 297 | + case RC_MOVE: |
| 298 | + $vals['type'] = 'move'; |
| 299 | + break; |
| 300 | + case RC_LOG: |
| 301 | + $vals['type'] = 'log'; |
| 302 | + break; |
| 303 | + case RC_MOVE_OVER_REDIRECT: |
| 304 | + $vals['type'] = 'move over redirect'; |
| 305 | + break; |
| 306 | + default: |
| 307 | + $vals['type'] = $type; |
294 | 308 | } |
295 | 309 | |
296 | 310 | /* Create a new entry in the result for the title. */ |
Index: trunk/phase3/includes/api/ApiQueryLinks.php |
— | — | @@ -110,6 +110,7 @@ |
111 | 111 | $order[] = "{$this->prefix}_from"; |
112 | 112 | if ( count( $params['namespace'] ) != 1 ) |
113 | 113 | $order[] = "{$this->prefix}_namespace"; |
| 114 | + |
114 | 115 | $order[] = "{$this->prefix}_title"; |
115 | 116 | $this->addOption( 'ORDER BY', implode( ", ", $order ) ); |
116 | 117 | $this->addOption( 'USE INDEX', "{$this->prefix}_from" ); |
— | — | @@ -141,7 +142,6 @@ |
142 | 143 | } |
143 | 144 | } |
144 | 145 | } else { |
145 | | - |
146 | 146 | $titles = array(); |
147 | 147 | $count = 0; |
148 | 148 | while ( $row = $db->fetchObject( $res ) ) { |
Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -66,6 +66,7 @@ |
67 | 67 | $this->dieUsage( "There is no revision ID $oldid", 'missingrev' ); |
68 | 68 | if ( !$rev->userCan( Revision::DELETED_TEXT ) ) |
69 | 69 | $this->dieUsage( "You don't have permission to view deleted revisions", 'permissiondenied' ); |
| 70 | + |
70 | 71 | $text = $rev->getText( Revision::FOR_THIS_USER ); |
71 | 72 | $titleObj = $rev->getTitle(); |
72 | 73 | $wgTitle = $titleObj; |
Index: trunk/phase3/includes/api/ApiQueryAllpages.php |
— | — | @@ -51,7 +51,6 @@ |
52 | 52 | } |
53 | 53 | |
54 | 54 | private function run( $resultPageSet = null ) { |
55 | | - |
56 | 55 | $db = $this->getDB(); |
57 | 56 | |
58 | 57 | $params = $this->extractRequestParams(); |
Index: trunk/phase3/includes/api/ApiProtect.php |
— | — | @@ -78,10 +78,12 @@ |
79 | 79 | { |
80 | 80 | $p = explode( '=', $prot ); |
81 | 81 | $protections[$p[0]] = ( $p[1] == 'all' ? '' : $p[1] ); |
| 82 | + |
82 | 83 | if ( $titleObj->exists() && $p[0] == 'create' ) |
83 | 84 | $this->dieUsageMsg( array( 'create-titleexists' ) ); |
84 | 85 | if ( !$titleObj->exists() && $p[0] != 'create' ) |
85 | 86 | $this->dieUsageMsg( array( 'missingtitle-createonly' ) ); |
| 87 | + |
86 | 88 | if ( !in_array( $p[0], $restrictionTypes ) && $p[0] != 'create' ) |
87 | 89 | $this->dieUsageMsg( array( 'protect-invalidaction', $p[0] ) ); |
88 | 90 | if ( !in_array( $p[1], $wgRestrictionLevels ) && $p[1] != 'all' ) |
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php |
— | — | @@ -109,11 +109,14 @@ |
110 | 110 | $this->addFields( array( 'page_id', 'page_title', 'page_namespace' ) ); |
111 | 111 | else |
112 | 112 | $this->addFields( $resultPageSet->getPageTableFields() ); |
| 113 | + |
113 | 114 | $this->addFields( 'page_is_redirect' ); |
114 | 115 | $this->addWhereFld( $this->bl_title, $this->rootTitle->getDBkey() ); |
| 116 | + |
115 | 117 | if ( $this->hasNS ) |
116 | 118 | $this->addWhereFld( $this->bl_ns, $this->rootTitle->getNamespace() ); |
117 | 119 | $this->addWhereFld( 'page_namespace', $this->params['namespace'] ); |
| 120 | + |
118 | 121 | if ( !is_null( $this->contID ) ) |
119 | 122 | $this->addWhere( "{$this->bl_from}>={$this->contID}" ); |
120 | 123 | |
— | — | @@ -136,13 +139,16 @@ |
137 | 140 | $db = $this->getDB(); |
138 | 141 | $this->addTables( array( 'page', $this->bl_table ) ); |
139 | 142 | $this->addWhere( "{$this->bl_from}=page_id" ); |
| 143 | + |
140 | 144 | if ( is_null( $resultPageSet ) ) |
141 | 145 | $this->addFields( array( 'page_id', 'page_title', 'page_namespace', 'page_is_redirect' ) ); |
142 | 146 | else |
143 | 147 | $this->addFields( $resultPageSet->getPageTableFields() ); |
| 148 | + |
144 | 149 | $this->addFields( $this->bl_title ); |
145 | 150 | if ( $this->hasNS ) |
146 | 151 | $this->addFields( $this->bl_ns ); |
| 152 | + |
147 | 153 | // We can't use LinkBatch here because $this->hasNS may be false |
148 | 154 | $titleWhere = array(); |
149 | 155 | foreach ( $this->redirTitles as $t ) |
— | — | @@ -150,6 +156,7 @@ |
151 | 157 | ( $this->hasNS ? " AND {$this->bl_ns} = '{$t->getNamespace()}'" : "" ); |
152 | 158 | $this->addWhere( $db->makeList( $titleWhere, LIST_OR ) ); |
153 | 159 | $this->addWhereFld( 'page_namespace', $this->params['namespace'] ); |
| 160 | + |
154 | 161 | if ( !is_null( $this->redirID ) ) |
155 | 162 | { |
156 | 163 | $first = $this->redirTitles[0]; |
— | — | @@ -172,6 +179,7 @@ |
173 | 180 | $this->addWhereFld( 'page_is_redirect', 1 ); |
174 | 181 | else if ( $this->params['filterredir'] == 'nonredirects' ) |
175 | 182 | $this->addWhereFld( 'page_is_redirect', 0 ); |
| 183 | + |
176 | 184 | $this->addOption( 'LIMIT', $this->params['limit'] + 1 ); |
177 | 185 | $this->addOption( 'ORDER BY', $this->bl_sort ); |
178 | 186 | $this->addOption( 'USE INDEX', array( 'page' => 'PRIMARY' ) ); |
— | — | @@ -356,13 +364,16 @@ |
357 | 365 | // Illegal continue parameter |
358 | 366 | $this->dieUsage( "Invalid continue param. You should pass the original value returned by the previous query", "_badcontinue" ); |
359 | 367 | $this->rootTitle = Title::makeTitleSafe( $rootNs, $continueList[1] ); |
| 368 | + |
360 | 369 | if ( !$this->rootTitle ) |
361 | 370 | $this->dieUsage( "Invalid continue param. You should pass the original value returned by the previous query", "_badcontinue" ); |
362 | 371 | $contID = intval( $continueList[2] ); |
| 372 | + |
363 | 373 | if ( $contID === 0 && $continueList[2] !== '0' ) |
364 | 374 | $this->dieUsage( "Invalid continue param. You should pass the original value returned by the previous query", "_badcontinue" ); |
365 | 375 | $this->contID = $contID; |
366 | 376 | $redirID = intval( @$continueList[3] ); |
| 377 | + |
367 | 378 | if ( $redirID === 0 && @$continueList[3] !== '0' ) |
368 | 379 | // This one isn't required |
369 | 380 | return; |
Index: trunk/phase3/includes/api/ApiQueryBase.php |
— | — | @@ -226,7 +226,6 @@ |
227 | 227 | * @return ResultWrapper |
228 | 228 | */ |
229 | 229 | protected function select( $method ) { |
230 | | - |
231 | 230 | // getDB has its own profileDBIn/Out calls |
232 | 231 | $db = $this->getDB(); |
233 | 232 | |
Index: trunk/phase3/includes/api/ApiQueryAllmessages.php |
— | — | @@ -77,9 +77,9 @@ |
78 | 78 | $result = $this->getResult(); |
79 | 79 | foreach ( $messages_target as $message ) { |
80 | 80 | // Skip all messages up to $params['from'] |
81 | | - if ( $skip && $message === $params['from'] ) |
| 81 | + if ( $skip && $message === $params['from'] ) { |
82 | 82 | $skip = false; |
83 | | - if ( !$skip ) { |
| 83 | + |
84 | 84 | $a = array( 'name' => $message ); |
85 | 85 | $msg = wfMsgGetKey( $message, true, false, false ); |
86 | 86 | if ( wfEmptyMsg( $message, $msg ) ) |
Index: trunk/phase3/includes/api/ApiQueryProtectedTitles.php |
— | — | @@ -91,12 +91,16 @@ |
92 | 92 | ApiQueryBase::addTitleInfo( $vals, $title ); |
93 | 93 | if ( isset( $prop['timestamp'] ) ) |
94 | 94 | $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->pt_timestamp ); |
| 95 | + |
95 | 96 | if ( isset( $prop['user'] ) && !is_null( $row->user_name ) ) |
96 | 97 | $vals['user'] = $row->user_name; |
| 98 | + |
97 | 99 | if ( isset( $prop['comment'] ) ) |
98 | 100 | $vals['comment'] = $row->pt_reason; |
| 101 | + |
99 | 102 | if ( isset( $prop['expiry'] ) ) |
100 | 103 | $vals['expiry'] = Block::decodeExpiry( $row->pt_expiry, TS_ISO_8601 ); |
| 104 | + |
101 | 105 | if ( isset( $prop['level'] ) ) |
102 | 106 | $vals['level'] = $row->pt_create_perm; |
103 | 107 | |
Index: trunk/phase3/includes/api/ApiQuery.php |
— | — | @@ -197,22 +197,16 @@ |
198 | 198 | $this->params = $this->extractRequestParams(); |
199 | 199 | $this->redirects = $this->params['redirects']; |
200 | 200 | |
201 | | - // |
202 | 201 | // Create PageSet |
203 | | - // |
204 | 202 | $this->mPageSet = new ApiPageSet( $this, $this->redirects ); |
205 | 203 | |
206 | | - // |
207 | 204 | // Instantiate requested modules |
208 | | - // |
209 | 205 | $modules = array (); |
210 | 206 | $this->InstantiateModules( $modules, 'prop', $this->mQueryPropModules ); |
211 | 207 | $this->InstantiateModules( $modules, 'list', $this->mQueryListModules ); |
212 | 208 | $this->InstantiateModules( $modules, 'meta', $this->mQueryMetaModules ); |
213 | 209 | |
214 | | - // |
215 | 210 | // If given, execute generator to substitute user supplied data with generated data. |
216 | | - // |
217 | 211 | if ( isset ( $this->params['generator'] ) ) { |
218 | 212 | $this->executeGeneratorModule( $this->params['generator'], $modules ); |
219 | 213 | } else { |
— | — | @@ -221,14 +215,10 @@ |
222 | 216 | $this->mPageSet->execute(); |
223 | 217 | } |
224 | 218 | |
225 | | - // |
226 | 219 | // Record page information (title, namespace, if exists, etc) |
227 | | - // |
228 | 220 | $this->outputGeneralPageInfo(); |
229 | 221 | |
230 | | - // |
231 | 222 | // Execute all requested modules. |
232 | | - // |
233 | 223 | foreach ( $modules as $module ) { |
234 | 224 | $module->profileIn(); |
235 | 225 | $module->execute(); |
— | — | @@ -391,6 +381,7 @@ |
392 | 382 | $exporter->closeStream(); |
393 | 383 | $exportxml = ob_get_contents(); |
394 | 384 | ob_end_clean(); |
| 385 | + |
395 | 386 | // Don't check the size of exported stuff |
396 | 387 | // It's not continuable, so it would cause more |
397 | 388 | // problems than it'd solve |
Index: trunk/phase3/includes/api/ApiParamInfo.php |
— | — | @@ -147,9 +147,11 @@ |
148 | 148 | ApiBase::LIMIT_SML2 : |
149 | 149 | ApiBase::LIMIT_SML1; |
150 | 150 | } |
| 151 | + |
151 | 152 | if ( isset( $p[ApiBase::PARAM_ALLOW_DUPLICATES] ) ) |
152 | 153 | if ( $p[ApiBase::PARAM_ALLOW_DUPLICATES] ) |
153 | 154 | $a['allowsduplicates'] = ''; |
| 155 | + |
154 | 156 | if ( isset( $p[ApiBase::PARAM_TYPE] ) ) |
155 | 157 | { |
156 | 158 | $a['type'] = $p[ApiBase::PARAM_TYPE]; |
Index: trunk/phase3/includes/api/ApiQueryInfo.php |
— | — | @@ -305,12 +305,16 @@ |
306 | 306 | $this->protections[$title->getNamespace()][$title->getDBkey()]; |
307 | 307 | $this->getResult()->setIndexedTagName( $pageInfo['protection'], 'pr' ); |
308 | 308 | } |
| 309 | + |
309 | 310 | if ( $this->fld_watched && isset( $this->watched[$title->getNamespace()][$title->getDBkey()] ) ) |
310 | 311 | $pageInfo['watched'] = ''; |
| 312 | + |
311 | 313 | if ( $this->fld_talkid && isset( $this->talkids[$title->getNamespace()][$title->getDBkey()] ) ) |
312 | 314 | $pageInfo['talkid'] = $this->talkids[$title->getNamespace()][$title->getDBkey()]; |
| 315 | + |
313 | 316 | if ( $this->fld_subjectid && isset( $this->subjectids[$title->getNamespace()][$title->getDBkey()] ) ) |
314 | 317 | $pageInfo['subjectid'] = $this->subjectids[$title->getNamespace()][$title->getDBkey()]; |
| 318 | + |
315 | 319 | if ( $this->fld_url ) { |
316 | 320 | $pageInfo['fullurl'] = $title->getFullURL(); |
317 | 321 | $pageInfo['editurl'] = $title->getFullURL( 'action=edit' ); |
Index: trunk/phase3/includes/api/ApiQueryTags.php |
— | — | @@ -172,6 +172,6 @@ |
173 | 173 | } |
174 | 174 | |
175 | 175 | public function getVersion() { |
176 | | - return __CLASS__ . ': $Id: ApiQueryTags.php'; |
| 176 | + return __CLASS__ . ': $Id$'; |
177 | 177 | } |
178 | 178 | } |