Index: branches/uploadwizard/phase3/maintenance/tests/phpunit/includes/UploadFromUrlTest.php |
— | — | @@ -235,7 +235,7 @@ |
236 | 236 | $a->doDeleteArticle( '' ); |
237 | 237 | } |
238 | 238 | |
239 | | - $this->assertFalse( (bool)$talk->getArticleId( GAID_FOR_UPDATE ), 'User talk does not exist' ); |
| 239 | + $this->assertFalse( (bool)$talk->getArticleId( Title::GAID_FOR_UPDATE ), 'User talk does not exist' ); |
240 | 240 | |
241 | 241 | $data = $this->doApiRequest( array( |
242 | 242 | 'action' => 'upload', |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | $job->run(); |
254 | 254 | |
255 | 255 | $this->assertTrue( wfLocalFile( 'UploadFromUrlTest.png' )->exists() ); |
256 | | - $this->assertTrue( (bool)$talk->getArticleId( GAID_FOR_UPDATE ), 'User talk exists' ); |
| 256 | + $this->assertTrue( (bool)$talk->getArticleId( Title::GAID_FOR_UPDATE ), 'User talk exists' ); |
257 | 257 | |
258 | 258 | $this->deleteFile( 'UploadFromUrlTest.png' ); |
259 | 259 | |
Index: branches/uploadwizard/phase3/includes/Article.php |
— | — | @@ -3111,7 +3111,7 @@ |
3112 | 3112 | public function doDelete( $reason, $suppress = false ) { |
3113 | 3113 | global $wgOut, $wgUser; |
3114 | 3114 | |
3115 | | - $id = $this->mTitle->getArticleID( GAID_FOR_UPDATE ); |
| 3115 | + $id = $this->mTitle->getArticleID( Title::GAID_FOR_UPDATE ); |
3116 | 3116 | |
3117 | 3117 | $error = ''; |
3118 | 3118 | if ( wfRunHooks( 'ArticleDelete', array( &$this, &$wgUser, &$reason, &$error ) ) ) { |
— | — | @@ -3171,7 +3171,7 @@ |
3172 | 3172 | |
3173 | 3173 | $dbw = wfGetDB( DB_MASTER ); |
3174 | 3174 | $t = $this->mTitle->getDBkey(); |
3175 | | - $id = $id ? $id : $this->mTitle->getArticleID( GAID_FOR_UPDATE ); |
| 3175 | + $id = $id ? $id : $this->mTitle->getArticleID( Title::GAID_FOR_UPDATE ); |
3176 | 3176 | |
3177 | 3177 | if ( $t === '' || $id == 0 ) { |
3178 | 3178 | return false; |
Index: branches/uploadwizard/phase3/includes/EditPage.php |
— | — | @@ -869,7 +869,7 @@ |
870 | 870 | wfProfileOut( __METHOD__ . '-checks' ); |
871 | 871 | |
872 | 872 | # If article is new, insert it. |
873 | | - $aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE ); |
| 873 | + $aid = $this->mTitle->getArticleID( Title::GAID_FOR_UPDATE ); |
874 | 874 | if ( 0 == $aid ) { |
875 | 875 | // Late check for create permission, just in case *PARANOIA* |
876 | 876 | if ( !$this->mTitle->userCan( 'create' ) ) { |
Index: branches/uploadwizard/phase3/includes/Title.php |
— | — | @@ -13,8 +13,6 @@ |
14 | 14 | require_once( dirname( __FILE__ ) . '/normal/UtfNormal.php' ); |
15 | 15 | } |
16 | 16 | |
17 | | -define ( 'GAID_FOR_UPDATE', 1 ); |
18 | | - |
19 | 17 | /** |
20 | 18 | * Represents a title within MediaWiki. |
21 | 19 | * Optionally may contain an interwiki designation or namespace. |
— | — | @@ -36,7 +34,13 @@ |
37 | 35 | */ |
38 | 36 | const CACHE_MAX = 1000; |
39 | 37 | |
| 38 | + /** |
| 39 | + * Used to be GAID_FOR_UPDATE define. Used with getArticleId() and friends |
| 40 | + * to use the master DB |
| 41 | + */ |
| 42 | + const GAID_FOR_UPDATE = 1; |
40 | 43 | |
| 44 | + |
41 | 45 | /** |
42 | 46 | * @name Private member variables |
43 | 47 | * Please use the accessor functions instead. |
— | — | @@ -193,11 +197,11 @@ |
194 | 198 | * Create a new Title from an article ID |
195 | 199 | * |
196 | 200 | * @param $id \type{\int} the page_id corresponding to the Title to create |
197 | | - * @param $flags \type{\int} use GAID_FOR_UPDATE to use master |
| 201 | + * @param $flags \type{\int} use Title::GAID_FOR_UPDATE to use master |
198 | 202 | * @return \type{Title} the new object, or NULL on an error |
199 | 203 | */ |
200 | 204 | public static function newFromID( $id, $flags = 0 ) { |
201 | | - $db = ( $flags & GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
| 205 | + $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
202 | 206 | $row = $db->selectRow( 'page', '*', array( 'page_id' => $id ), __METHOD__ ); |
203 | 207 | if ( $row !== false ) { |
204 | 208 | $title = Title::newFromRow( $row ); |
— | — | @@ -2326,7 +2330,7 @@ |
2327 | 2331 | * Get the article ID for this Title from the link cache, |
2328 | 2332 | * adding it if necessary |
2329 | 2333 | * |
2330 | | - * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select |
| 2334 | + * @param $flags \type{\int} a bit field; may be Title::GAID_FOR_UPDATE to select |
2331 | 2335 | * for update |
2332 | 2336 | * @return \type{\int} the ID |
2333 | 2337 | */ |
— | — | @@ -2335,7 +2339,7 @@ |
2336 | 2340 | return $this->mArticleID = 0; |
2337 | 2341 | } |
2338 | 2342 | $linkCache = LinkCache::singleton(); |
2339 | | - if ( $flags & GAID_FOR_UPDATE ) { |
| 2343 | + if ( $flags & self::GAID_FOR_UPDATE ) { |
2340 | 2344 | $oldUpdate = $linkCache->forUpdate( true ); |
2341 | 2345 | $linkCache->clearLink( $this ); |
2342 | 2346 | $this->mArticleID = $linkCache->addLinkObj( $this ); |
— | — | @@ -2352,7 +2356,7 @@ |
2353 | 2357 | * Is this an article that is a redirect page? |
2354 | 2358 | * Uses link cache, adding it if necessary |
2355 | 2359 | * |
2356 | | - * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select for update |
| 2360 | + * @param $flags \type{\int} a bit field; may be Title::GAID_FOR_UPDATE to select for update |
2357 | 2361 | * @return \type{\bool} |
2358 | 2362 | */ |
2359 | 2363 | public function isRedirect( $flags = 0 ) { |
— | — | @@ -2373,7 +2377,7 @@ |
2374 | 2378 | * What is the length of this page? |
2375 | 2379 | * Uses link cache, adding it if necessary |
2376 | 2380 | * |
2377 | | - * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select for update |
| 2381 | + * @param $flags \type{\int} a bit field; may be Title::GAID_FOR_UPDATE to select for update |
2378 | 2382 | * @return \type{\bool} |
2379 | 2383 | */ |
2380 | 2384 | public function getLength( $flags = 0 ) { |
— | — | @@ -2393,7 +2397,7 @@ |
2394 | 2398 | /** |
2395 | 2399 | * What is the page_latest field for this page? |
2396 | 2400 | * |
2397 | | - * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select for update |
| 2401 | + * @param $flags \type{\int} a bit field; may be Title::GAID_FOR_UPDATE to select for update |
2398 | 2402 | * @return \type{\int} or 0 if the page doesn't exist |
2399 | 2403 | */ |
2400 | 2404 | public function getLatestRevID( $flags = 0 ) { |
— | — | @@ -3610,11 +3614,11 @@ |
3611 | 3615 | * Get the revision ID of the previous revision |
3612 | 3616 | * |
3613 | 3617 | * @param $revId \type{\int} Revision ID. Get the revision that was before this one. |
3614 | | - * @param $flags \type{\int} GAID_FOR_UPDATE |
| 3618 | + * @param $flags \type{\int} Title::GAID_FOR_UPDATE |
3615 | 3619 | * @return \twotypes{\int,\bool} Old revision ID, or FALSE if none exists |
3616 | 3620 | */ |
3617 | 3621 | public function getPreviousRevisionID( $revId, $flags = 0 ) { |
3618 | | - $db = ( $flags & GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
| 3622 | + $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
3619 | 3623 | return $db->selectField( 'revision', 'rev_id', |
3620 | 3624 | array( |
3621 | 3625 | 'rev_page' => $this->getArticleId( $flags ), |
— | — | @@ -3629,11 +3633,11 @@ |
3630 | 3634 | * Get the revision ID of the next revision |
3631 | 3635 | * |
3632 | 3636 | * @param $revId \type{\int} Revision ID. Get the revision that was after this one. |
3633 | | - * @param $flags \type{\int} GAID_FOR_UPDATE |
| 3637 | + * @param $flags \type{\int} Title::GAID_FOR_UPDATE |
3634 | 3638 | * @return \twotypes{\int,\bool} Next revision ID, or FALSE if none exists |
3635 | 3639 | */ |
3636 | 3640 | public function getNextRevisionID( $revId, $flags = 0 ) { |
3637 | | - $db = ( $flags & GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
| 3641 | + $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
3638 | 3642 | return $db->selectField( 'revision', 'rev_id', |
3639 | 3643 | array( |
3640 | 3644 | 'rev_page' => $this->getArticleId( $flags ), |
— | — | @@ -3647,11 +3651,11 @@ |
3648 | 3652 | /** |
3649 | 3653 | * Get the first revision of the page |
3650 | 3654 | * |
3651 | | - * @param $flags \type{\int} GAID_FOR_UPDATE |
| 3655 | + * @param $flags \type{\int} Title::GAID_FOR_UPDATE |
3652 | 3656 | * @return Revision (or NULL if page doesn't exist) |
3653 | 3657 | */ |
3654 | 3658 | public function getFirstRevision( $flags = 0 ) { |
3655 | | - $db = ( $flags & GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
| 3659 | + $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
3656 | 3660 | $pageId = $this->getArticleId( $flags ); |
3657 | 3661 | if ( !$pageId ) { |
3658 | 3662 | return null; |
Property changes on: branches/uploadwizard/phase3/includes/Title.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
3659 | 3663 | Merged /trunk/phase3/includes/Title.php:r74034 |
Index: branches/uploadwizard/phase3/includes/FileDeleteForm.php |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | $log->addEntry( 'delete', $title, $logComment ); |
118 | 118 | } |
119 | 119 | } else { |
120 | | - $id = $title->getArticleID( GAID_FOR_UPDATE ); |
| 120 | + $id = $title->getArticleID( Title::GAID_FOR_UPDATE ); |
121 | 121 | $article = new Article( $title ); |
122 | 122 | $error = ''; |
123 | 123 | $dbw = wfGetDB( DB_MASTER ); |