Index: trunk/phase3/maintenance/storage/fixBug20757.php |
— | — | @@ -213,7 +213,7 @@ |
214 | 214 | |
215 | 215 | if ( !$dryRun ) { |
216 | 216 | // Reset the text row to point to the original copy |
217 | | - $dbw->begin(); |
| 217 | + $dbw->begin( __METHOD__ ); |
218 | 218 | $dbw->update( |
219 | 219 | 'text', |
220 | 220 | // SET |
— | — | @@ -241,7 +241,7 @@ |
242 | 242 | ), |
243 | 243 | __METHOD__ |
244 | 244 | ); |
245 | | - $dbw->commit(); |
| 245 | + $dbw->commit( __METHOD__ ); |
246 | 246 | $this->waitForSlaves(); |
247 | 247 | } |
248 | 248 | |
Index: trunk/phase3/maintenance/storage/recompressTracked.php |
— | — | @@ -528,7 +528,7 @@ |
529 | 529 | exit( 1 ); |
530 | 530 | } |
531 | 531 | $dbw = wfGetDB( DB_MASTER ); |
532 | | - $dbw->begin(); |
| 532 | + $dbw->begin( __METHOD__ ); |
533 | 533 | $dbw->update( 'text', |
534 | 534 | array( // set |
535 | 535 | 'old_text' => $url, |
— | — | @@ -544,7 +544,7 @@ |
545 | 545 | array( 'bt_text_id' => $textId ), |
546 | 546 | __METHOD__ |
547 | 547 | ); |
548 | | - $dbw->commit(); |
| 548 | + $dbw->commit( __METHOD__ ); |
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
— | — | @@ -739,7 +739,7 @@ |
740 | 740 | // |
741 | 741 | // We do a locking read to prevent closer-run race conditions. |
742 | 742 | $dbw = wfGetDB( DB_MASTER ); |
743 | | - $dbw->begin(); |
| 743 | + $dbw->begin( __METHOD__ ); |
744 | 744 | $res = $dbw->select( 'blob_tracking', |
745 | 745 | array( 'bt_text_id', 'bt_moved' ), |
746 | 746 | array( 'bt_text_id' => array_keys( $this->referrers ) ), |
— | — | @@ -773,7 +773,7 @@ |
774 | 774 | $store = $this->parent->store; |
775 | 775 | $targetDB = $store->getMaster( $targetCluster ); |
776 | 776 | $targetDB->clearFlag( DBO_TRX ); // we manage the transactions |
777 | | - $targetDB->begin(); |
| 777 | + $targetDB->begin( __METHOD__ ); |
778 | 778 | $baseUrl = $this->parent->store->store( $targetCluster, serialize( $this->cgz ) ); |
779 | 779 | |
780 | 780 | // Write the new URLs to the blob_tracking table |
— | — | @@ -789,10 +789,10 @@ |
790 | 790 | ); |
791 | 791 | } |
792 | 792 | |
793 | | - $targetDB->commit(); |
| 793 | + $targetDB->commit( __METHOD__ ); |
794 | 794 | // Critical section here: interruption at this point causes blob duplication |
795 | 795 | // Reversing the order of the commits would cause data loss instead |
796 | | - $dbw->commit(); |
| 796 | + $dbw->commit( __METHOD__ ); |
797 | 797 | |
798 | 798 | // Write the new URLs to the text table and set the moved flag |
799 | 799 | if ( !$this->parent->copyOnly ) { |
Index: trunk/phase3/maintenance/rebuildFileCache.php |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | array( 'ORDER BY' => 'page_id ASC', 'USE INDEX' => 'PRIMARY' ) |
95 | 95 | ); |
96 | 96 | |
97 | | - $dbw->begin(); // for any changes |
| 97 | + $dbw->begin( __METHOD__ ); // for any changes |
98 | 98 | foreach ( $res as $row ) { |
99 | 99 | $rebuilt = false; |
100 | 100 | $wgRequestTime = microtime( true ); # bug 22852 |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | $this->output( "Page {$row->page_id} not cacheable\n" ); |
141 | 141 | } |
142 | 142 | } |
143 | | - $dbw->commit(); // commit any changes (just for sanity) |
| 143 | + $dbw->commit( __METHOD__ ); // commit any changes (just for sanity) |
144 | 144 | |
145 | 145 | $blockStart += $this->mBatchSize; |
146 | 146 | $blockEnd += $this->mBatchSize; |
Index: trunk/phase3/maintenance/refreshLinks.php |
— | — | @@ -217,13 +217,13 @@ |
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
221 | | - $dbw->begin(); |
| 221 | + $dbw->begin( __METHOD__ ); |
222 | 222 | |
223 | 223 | $options = new ParserOptions; |
224 | 224 | $parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() ); |
225 | 225 | $update = new LinksUpdate( $title, $parserOutput, false ); |
226 | 226 | $update->doUpdate(); |
227 | | - $dbw->commit(); |
| 227 | + $dbw->commit( __METHOD__ ); |
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
Index: trunk/phase3/maintenance/removeUnusedAccounts.php |
— | — | @@ -95,12 +95,12 @@ |
96 | 96 | 'image' => 'img', 'oldimage' => 'oi', 'filearchive' => 'fa' ); |
97 | 97 | $count = 0; |
98 | 98 | |
99 | | - $dbo->begin(); |
| 99 | + $dbo->begin( __METHOD__ ); |
100 | 100 | foreach ( $checks as $table => $fprefix ) { |
101 | 101 | $conds = array( $fprefix . '_user' => $id ); |
102 | 102 | $count += (int)$dbo->selectField( $table, 'COUNT(*)', $conds, __METHOD__ ); |
103 | 103 | } |
104 | | - $dbo->commit(); |
| 104 | + $dbo->commit( __METHOD__ ); |
105 | 105 | |
106 | 106 | return $count == 0; |
107 | 107 | } |
Index: trunk/phase3/maintenance/updateCollation.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | ); |
106 | 106 | $this->output( " processing..." ); |
107 | 107 | |
108 | | - $dbw->begin(); |
| 108 | + $dbw->begin( __METHOD__ ); |
109 | 109 | foreach ( $res as $row ) { |
110 | 110 | $title = Title::newFromRow( $row ); |
111 | 111 | if ( !$row->cl_collation ) { |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | __METHOD__ |
145 | 145 | ); |
146 | 146 | } |
147 | | - $dbw->commit(); |
| 147 | + $dbw->commit( __METHOD__ ); |
148 | 148 | |
149 | 149 | if ( $force && $row ) { |
150 | 150 | $encFrom = $dbw->addQuotes( $row->cl_from ); |
Index: trunk/phase3/maintenance/nukePage.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | $delete = $this->getOption( 'delete', false ); |
40 | 40 | |
41 | 41 | $dbw = wfGetDB( DB_MASTER ); |
42 | | - $dbw->begin(); |
| 42 | + $dbw->begin( __METHOD__ ); |
43 | 43 | |
44 | 44 | $tbl_pag = $dbw->tableName( 'page' ); |
45 | 45 | $tbl_rec = $dbw->tableName( 'recentchanges' ); |
— | — | @@ -93,20 +93,20 @@ |
94 | 94 | } |
95 | 95 | } else { |
96 | 96 | $this->output( "not found in database.\n" ); |
97 | | - $dbw->commit(); |
| 97 | + $dbw->commit( __METHOD__ ); |
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | 101 | public function deleteRevisions( $ids ) { |
102 | 102 | $dbw = wfGetDB( DB_MASTER ); |
103 | | - $dbw->begin(); |
| 103 | + $dbw->begin( __METHOD__ ); |
104 | 104 | |
105 | 105 | $tbl_rev = $dbw->tableName( 'revision' ); |
106 | 106 | |
107 | 107 | $set = implode( ', ', $ids ); |
108 | 108 | $dbw->query( "DELETE FROM $tbl_rev WHERE rev_id IN ( $set )" ); |
109 | 109 | |
110 | | - $dbw->commit(); |
| 110 | + $dbw->commit( __METHOD__ ); |
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
Index: trunk/phase3/maintenance/nukeNS.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $delete = $this->getOption( 'delete', false ); |
51 | 51 | $all = $this->getOption( 'all', false ); |
52 | 52 | $dbw = wfGetDB( DB_MASTER ); |
53 | | - $dbw->begin(); |
| 53 | + $dbw->begin( __METHOD__ ); |
54 | 54 | |
55 | 55 | $tbl_pag = $dbw->tableName( 'page' ); |
56 | 56 | $tbl_rev = $dbw->tableName( 'revision' ); |
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | // I already have the id & revs |
82 | 82 | if ( $delete ) { |
83 | 83 | $dbw->query( "DELETE FROM $tbl_pag WHERE page_id = $id" ); |
84 | | - $dbw->commit(); |
| 84 | + $dbw->commit( __METHOD__ ); |
85 | 85 | // Delete revisions as appropriate |
86 | 86 | $child = $this->runChild( 'NukePage', 'nukePage.php' ); |
87 | 87 | $child->deleteRevisions( $revs ); |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | $this->output( "skip: " . $title->getPrefixedText() . "\n" ); |
93 | 93 | } |
94 | 94 | } |
95 | | - $dbw->commit(); |
| 95 | + $dbw->commit( __METHOD__ ); |
96 | 96 | |
97 | 97 | if ( $n_deleted > 0 ) { |
98 | 98 | # update statistics - better to decrement existing count, or just count |
Index: trunk/phase3/maintenance/deleteBatch.php |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | } |
91 | 91 | |
92 | 92 | $this->output( $title->getPrefixedText() ); |
93 | | - $dbw->begin(); |
| 93 | + $dbw->begin( __METHOD__ ); |
94 | 94 | if ( $title->getNamespace() == NS_FILE ) { |
95 | 95 | $img = wfFindFile( $title ); |
96 | 96 | if ( $img && $img->isLocal() && !$img->delete( $reason ) ) { |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | $page = WikiPage::factory( $title ); |
101 | 101 | $error = ''; |
102 | 102 | $success = $page->doDeleteArticle( $reason, false, 0, false, $error, $user ); |
103 | | - $dbw->commit(); |
| 103 | + $dbw->commit( __METHOD__ ); |
104 | 104 | if ( $success ) { |
105 | 105 | $this->output( " Deleted!\n" ); |
106 | 106 | } else { |
Index: trunk/phase3/maintenance/purgeOldText.inc |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | |
29 | 29 | # Data should come off the master, wrapped in a transaction |
30 | 30 | $dbw = wfGetDB( DB_MASTER ); |
31 | | - $dbw->begin(); |
| 31 | + $dbw->begin( __METHOD__ ); |
32 | 32 | |
33 | 33 | $tbl_arc = $dbw->tableName( 'archive' ); |
34 | 34 | $tbl_rev = $dbw->tableName( 'revision' ); |
— | — | @@ -73,6 +73,6 @@ |
74 | 74 | } |
75 | 75 | |
76 | 76 | # Done |
77 | | - $dbw->commit(); |
| 77 | + $dbw->commit( __METHOD__ ); |
78 | 78 | |
79 | 79 | } |
Index: trunk/phase3/maintenance/populateRevisionSha1.php |
— | — | @@ -81,13 +81,13 @@ |
82 | 82 | AND $idCol IS NOT NULL AND {$prefix}_sha1 = ''"; |
83 | 83 | $res = $db->select( $table, '*', $cond, __METHOD__ ); |
84 | 84 | |
85 | | - $db->begin(); |
| 85 | + $db->begin( __METHOD__ ); |
86 | 86 | foreach ( $res as $row ) { |
87 | 87 | if ( $this->upgradeRow( $row, $table, $idCol, $prefix ) ) { |
88 | 88 | $count++; |
89 | 89 | } |
90 | 90 | } |
91 | | - $db->commit(); |
| 91 | + $db->commit( __METHOD__ ); |
92 | 92 | |
93 | 93 | $blockStart += $this->mBatchSize; |
94 | 94 | $blockEnd += $this->mBatchSize; |
— | — | @@ -102,20 +102,20 @@ |
103 | 103 | $res = $db->select( 'archive', '*', array( 'ar_rev_id IS NULL' ), __METHOD__ ); |
104 | 104 | |
105 | 105 | $updateSize = 0; |
106 | | - $db->begin(); |
| 106 | + $db->begin( __METHOD__ ); |
107 | 107 | foreach ( $res as $row ) { |
108 | 108 | if ( $this->upgradeLegacyArchiveRow( $row ) ) { |
109 | 109 | ++$count; |
110 | 110 | } |
111 | 111 | if ( ++$updateSize >= 100 ) { |
112 | 112 | $updateSize = 0; |
113 | | - $db->commit(); |
| 113 | + $db->commit( __METHOD__ ); |
114 | 114 | $this->output( "Commited row with ar_timestamp={$row->ar_timestamp}\n" ); |
115 | 115 | wfWaitForSlaves(); |
116 | | - $db->begin(); |
| 116 | + $db->begin( __METHOD__ ); |
117 | 117 | } |
118 | 118 | } |
119 | | - $db->commit(); |
| 119 | + $db->commit( __METHOD__ ); |
120 | 120 | } |
121 | 121 | |
122 | 122 | protected function upgradeRow( $row, $table, $idCol, $prefix ) { |
Index: trunk/phase3/maintenance/deleteArchivedRevisions.inc |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | static public function doDelete( $maint ) { |
36 | 36 | $dbw = wfGetDB( DB_MASTER ); |
37 | 37 | |
38 | | - $dbw->begin(); |
| 38 | + $dbw->begin( __METHOD__ ); |
39 | 39 | |
40 | 40 | $tbl_arch = $dbw->tableName( 'archive' ); |
41 | 41 | |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | |
51 | 51 | # This bit's done |
52 | 52 | # Purge redundant text records |
53 | | - $dbw->commit(); |
| 53 | + $dbw->commit( __METHOD__ ); |
54 | 54 | if ( $deletedRows ) { |
55 | 55 | $maint->purgeRedundantText( true ); |
56 | 56 | } |
Index: trunk/phase3/maintenance/deleteDefaultMessages.php |
— | — | @@ -68,10 +68,10 @@ |
69 | 69 | $dbw->ping(); |
70 | 70 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
71 | 71 | $page = WikiPage::factory( $title ); |
72 | | - $dbw->begin(); |
| 72 | + $dbw->begin( __METHOD__ ); |
73 | 73 | $error = ''; // Passed by ref |
74 | 74 | $page->doDeleteArticle( 'No longer required', false, 0, false, $error, $user ); |
75 | | - $dbw->commit(); |
| 75 | + $dbw->commit( __METHOD__ ); |
76 | 76 | } |
77 | 77 | |
78 | 78 | $this->output( 'done!', 'msg' ); |
Index: trunk/phase3/maintenance/migrateUserGroup.php |
— | — | @@ -50,14 +50,14 @@ |
51 | 51 | // Migrate users over in batches... |
52 | 52 | while ( $blockEnd <= $end ) { |
53 | 53 | $this->output( "Doing users $blockStart to $blockEnd\n" ); |
54 | | - $dbw->begin(); |
| 54 | + $dbw->begin( __METHOD__ ); |
55 | 55 | $dbw->update( 'user_groups', |
56 | 56 | array( 'ug_group' => $newGroup ), |
57 | 57 | array( 'ug_group' => $oldGroup, |
58 | 58 | "ug_user BETWEEN $blockStart AND $blockEnd" ) |
59 | 59 | ); |
60 | 60 | $count += $dbw->affectedRows(); |
61 | | - $dbw->commit(); |
| 61 | + $dbw->commit( __METHOD__ ); |
62 | 62 | $blockStart += $this->mBatchSize; |
63 | 63 | $blockEnd += $this->mBatchSize; |
64 | 64 | wfWaitForSlaves(); |
Index: trunk/phase3/maintenance/cleanupImages.php |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | } else { |
158 | 158 | $this->output( "renaming $path to $finalPath\n" ); |
159 | 159 | // @todo FIXME: Should this use File::move()? |
160 | | - $db->begin(); |
| 160 | + $db->begin( __METHOD__ ); |
161 | 161 | $db->update( 'image', |
162 | 162 | array( 'img_name' => $final ), |
163 | 163 | array( 'img_name' => $orig ), |
— | — | @@ -178,10 +178,10 @@ |
179 | 179 | } |
180 | 180 | } |
181 | 181 | if ( rename( $path, $finalPath ) ) { |
182 | | - $db->commit(); |
| 182 | + $db->commit( __METHOD__ ); |
183 | 183 | } else { |
184 | 184 | $this->error( "RENAME FAILED" ); |
185 | | - $db->rollback(); |
| 185 | + $db->rollback( __METHOD__ ); |
186 | 186 | } |
187 | 187 | } |
188 | 188 | } |
Index: trunk/phase3/maintenance/Maintenance.php |
— | — | @@ -954,7 +954,7 @@ |
955 | 955 | public function purgeRedundantText( $delete = true ) { |
956 | 956 | # Data should come off the master, wrapped in a transaction |
957 | 957 | $dbw = $this->getDB( DB_MASTER ); |
958 | | - $dbw->begin(); |
| 958 | + $dbw->begin( __METHOD__ ); |
959 | 959 | |
960 | 960 | $tbl_arc = $dbw->tableName( 'archive' ); |
961 | 961 | $tbl_rev = $dbw->tableName( 'revision' ); |
— | — | @@ -999,7 +999,7 @@ |
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | # Done |
1003 | | - $dbw->commit(); |
| 1003 | + $dbw->commit( __METHOD__ ); |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | /** |
Index: trunk/phase3/maintenance/reassignEdits.php |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | */ |
70 | 70 | private function doReassignEdits( &$from, &$to, $rc = false, $report = false ) { |
71 | 71 | $dbw = wfGetDB( DB_MASTER ); |
72 | | - $dbw->begin(); |
| 72 | + $dbw->begin( __METHOD__ ); |
73 | 73 | |
74 | 74 | # Count things |
75 | 75 | $this->output( "Checking current edits..." ); |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | | - $dbw->commit(); |
| 121 | + $dbw->commit( __METHOD__ ); |
122 | 122 | return (int)$total; |
123 | 123 | } |
124 | 124 | |
Index: trunk/phase3/maintenance/cleanupSpam.php |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | $this->output( "False match\n" ); |
108 | 108 | } else { |
109 | 109 | $dbw = wfGetDB( DB_MASTER ); |
110 | | - $dbw->begin(); |
| 110 | + $dbw->begin( __METHOD__ ); |
111 | 111 | $page = WikiPage::factory( $title ); |
112 | 112 | if ( !$rev ) { |
113 | 113 | // Didn't find a non-spammy revision, blank the page |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | $page->doEdit( $rev->getText(), wfMsgForContent( 'spam_reverting', $domain ), |
120 | 120 | EDIT_UPDATE, $rev->getId() ); |
121 | 121 | } |
122 | | - $dbw->commit(); |
| 122 | + $dbw->commit( __METHOD__ ); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
Index: trunk/phase3/maintenance/populateLogUsertext.php |
— | — | @@ -59,12 +59,12 @@ |
60 | 60 | $res = $db->select( array( 'logging', 'user' ), |
61 | 61 | array( 'log_id', 'user_name' ), $cond, __METHOD__ ); |
62 | 62 | |
63 | | - $db->begin(); |
| 63 | + $db->begin( __METHOD__ ); |
64 | 64 | foreach ( $res as $row ) { |
65 | 65 | $db->update( 'logging', array( 'log_user_text' => $row->user_name ), |
66 | 66 | array( 'log_id' => $row->log_id ), __METHOD__ ); |
67 | 67 | } |
68 | | - $db->commit(); |
| 68 | + $db->commit( __METHOD__ ); |
69 | 69 | $blockStart += $this->mBatchSize; |
70 | 70 | $blockEnd += $this->mBatchSize; |
71 | 71 | wfWaitForSlaves(); |
Index: trunk/phase3/maintenance/deleteOldRevisions.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | |
43 | 43 | # Data should come off the master, wrapped in a transaction |
44 | 44 | $dbw = wfGetDB( DB_MASTER ); |
45 | | - $dbw->begin(); |
| 45 | + $dbw->begin( __METHOD__ ); |
46 | 46 | |
47 | 47 | $tbl_pag = $dbw->tableName( 'page' ); |
48 | 48 | $tbl_rev = $dbw->tableName( 'revision' ); |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | |
92 | 92 | # This bit's done |
93 | 93 | # Purge redundant text records |
94 | | - $dbw->commit(); |
| 94 | + $dbw->commit( __METHOD__ ); |
95 | 95 | if ( $delete ) { |
96 | 96 | $this->purgeRedundantText( true ); |
97 | 97 | } |
Index: trunk/phase3/maintenance/deleteArchivedFiles.inc |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | static public function doDelete( $output, $force ) { |
26 | 26 | # Data should come off the master, wrapped in a transaction |
27 | 27 | $dbw = wfGetDB( DB_MASTER ); |
28 | | - $dbw->begin(); |
| 28 | + $dbw->begin( __METHOD__ ); |
29 | 29 | $tbl_arch = $dbw->tableName( 'filearchive' ); |
30 | 30 | $repo = RepoGroup::singleton()->getLocalRepo(); |
31 | 31 | # Get "active" revisions from the filearchive table |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
63 | | - $dbw->commit(); |
| 63 | + $dbw->commit( __METHOD__ ); |
64 | 64 | $output->handleOutput( "Done! [$count file(s)]\n" ); |
65 | 65 | } |
66 | 66 | } |
\ No newline at end of file |
Index: trunk/phase3/maintenance/deleteOrphanedRevisions.php |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | $report = $this->hasOption( 'report' ); |
41 | 41 | |
42 | 42 | $dbw = wfGetDB( DB_MASTER ); |
43 | | - $dbw->begin(); |
| 43 | + $dbw->begin( __METHOD__ ); |
44 | 44 | list( $page, $revision ) = $dbw->tableNamesN( 'page', 'revision' ); |
45 | 45 | |
46 | 46 | # Find all the orphaned revisions |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | $this->output( "done.\n" ); |
68 | 68 | |
69 | 69 | # Close the transaction and call the script to purge unused text records |
70 | | - $dbw->commit(); |
| 70 | + $dbw->commit( __METHOD__ ); |
71 | 71 | $this->purgeRedundantText( true ); |
72 | 72 | } |
73 | 73 | |
Index: trunk/phase3/maintenance/fixSlaveDesync.php |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | private function desyncFixPage( $pageID ) { |
90 | 90 | # Check for a corrupted page_latest |
91 | 91 | $dbw = wfGetDB( DB_MASTER ); |
92 | | - $dbw->begin(); |
| 92 | + $dbw->begin( __METHOD__ ); |
93 | 93 | $realLatest = $dbw->selectField( 'page', 'page_latest', array( 'page_id' => $pageID ), |
94 | 94 | __METHOD__, 'FOR UPDATE' ); |
95 | 95 | # list( $masterFile, $masterPos ) = $dbw->getMasterPos(); |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | } |
114 | 114 | if ( !$found ) { |
115 | 115 | $this->output( "page_id $pageID seems fine\n" ); |
116 | | - $dbw->commit(); |
| 116 | + $dbw->commit( __METHOD__ ); |
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | } |
201 | 201 | $this->output( "done\n" ); |
202 | 202 | } |
203 | | - $dbw->commit(); |
| 203 | + $dbw->commit( __METHOD__ ); |
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
Index: trunk/phase3/docs/database.txt |
— | — | @@ -153,9 +153,9 @@ |
154 | 154 | following syntax: |
155 | 155 | |
156 | 156 | $dbw = wfGetDB( DB_MASTER ); |
157 | | -$dbw->begin(); |
| 157 | +$dbw->begin( __METHOD__ ); |
158 | 158 | /* Do queries */ |
159 | | -$dbw->commit(); |
| 159 | +$dbw->commit( __METHOD__ ); |
160 | 160 | |
161 | 161 | Use of locking reads (e.g. the FOR UPDATE clause) is not advised. They |
162 | 162 | are poorly implemented in InnoDB and will cause regular deadlock errors. |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -540,7 +540,7 @@ |
541 | 541 | if ( $ignore ) { |
542 | 542 | $olde = error_reporting( $olde ); |
543 | 543 | if ( $didbegin ) { |
544 | | - $this->commit(); |
| 544 | + $this->commit( __METHOD__ ); |
545 | 545 | } |
546 | 546 | |
547 | 547 | // Set the affected row count for the whole operation |
— | — | @@ -587,7 +587,7 @@ |
588 | 588 | $didbegin = 0; |
589 | 589 | if ( $ignore ) { |
590 | 590 | if( !$this->mTrxLevel ) { |
591 | | - $this->begin(); |
| 591 | + $this->begin( __METHOD__ ); |
592 | 592 | $didbegin = 1; |
593 | 593 | } |
594 | 594 | $olde = error_reporting( 0 ); |
— | — | @@ -616,7 +616,7 @@ |
617 | 617 | } |
618 | 618 | $olde = error_reporting( $olde ); |
619 | 619 | if( $didbegin ) { |
620 | | - $this->commit(); |
| 620 | + $this->commit( __METHOD__ ); |
621 | 621 | } |
622 | 622 | |
623 | 623 | // Set the affected row count for the whole operation |
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php |
— | — | @@ -791,9 +791,9 @@ |
792 | 792 | protected function applySchema() { |
793 | 793 | if ( !( $this->mSchemaSet ) ) { |
794 | 794 | $this->mSchemaSet = true; |
795 | | - $this->begin(); |
| 795 | + $this->begin( __METHOD__ ); |
796 | 796 | $this->doQuery( "SET SCHEMA = $this->mSchema" ); |
797 | | - $this->commit(); |
| 797 | + $this->commit( __METHOD__ ); |
798 | 798 | } |
799 | 799 | } |
800 | 800 | |
— | — | @@ -1016,7 +1016,7 @@ |
1017 | 1017 | $res = true; |
1018 | 1018 | // If we are not in a transaction, we need to be for savepoint trickery |
1019 | 1019 | if ( !$this->mTrxLevel ) { |
1020 | | - $this->begin(); |
| 1020 | + $this->begin( __METHOD__ ); |
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | $sql = "INSERT INTO $table ( " . implode( ',', $keys ) . ' ) VALUES '; |
— | — | @@ -1031,7 +1031,7 @@ |
1032 | 1032 | $stmt = $this->prepare( $sql ); |
1033 | 1033 | |
1034 | 1034 | // start a transaction/enter transaction mode |
1035 | | - $this->begin(); |
| 1035 | + $this->begin( __METHOD__ ); |
1036 | 1036 | |
1037 | 1037 | if ( !$ignore ) { |
1038 | 1038 | //$first = true; |
Index: trunk/phase3/includes/UserMailer.php |
— | — | @@ -448,7 +448,7 @@ |
449 | 449 | if ( $watchers ) { |
450 | 450 | // Update wl_notificationtimestamp for all watching users except |
451 | 451 | // the editor |
452 | | - $dbw->begin(); |
| 452 | + $dbw->begin( __METHOD__ ); |
453 | 453 | $dbw->update( 'watchlist', |
454 | 454 | array( /* SET */ |
455 | 455 | 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp ) |
— | — | @@ -458,7 +458,7 @@ |
459 | 459 | 'wl_user' => $watchers |
460 | 460 | ), __METHOD__ |
461 | 461 | ); |
462 | | - $dbw->commit(); |
| 462 | + $dbw->commit( __METHOD__ ); |
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
Index: trunk/phase3/includes/filerepo/file/OldLocalFile.php |
— | — | @@ -260,7 +260,7 @@ |
261 | 261 | */ |
262 | 262 | function recordOldUpload( $srcPath, $archiveName, $timestamp, $comment, $user ) { |
263 | 263 | $dbw = $this->repo->getMasterDB(); |
264 | | - $dbw->begin(); |
| 264 | + $dbw->begin( __METHOD__ ); |
265 | 265 | |
266 | 266 | $dstPath = $this->repo->getZonePath( 'public' ) . '/' . $this->getRel(); |
267 | 267 | $props = $this->repo->getFileProps( $dstPath ); |
— | — | @@ -288,9 +288,9 @@ |
289 | 289 | ), __METHOD__ |
290 | 290 | ); |
291 | 291 | |
292 | | - $dbw->commit(); |
| 292 | + $dbw->commit( __METHOD__ ); |
293 | 293 | |
294 | 294 | return true; |
295 | 295 | } |
296 | | - |
| 296 | + |
297 | 297 | } |
Index: trunk/phase3/includes/filerepo/file/LocalFile.php |
— | — | @@ -959,7 +959,7 @@ |
960 | 960 | } |
961 | 961 | |
962 | 962 | $dbw = $this->repo->getMasterDB(); |
963 | | - $dbw->begin(); |
| 963 | + $dbw->begin( __METHOD__ ); |
964 | 964 | |
965 | 965 | if ( !$props ) { |
966 | 966 | $props = $this->repo->getFileProps( $this->getVirtualUrl() ); |
— | — | @@ -1111,7 +1111,7 @@ |
1112 | 1112 | |
1113 | 1113 | # Commit the transaction now, in case something goes wrong later |
1114 | 1114 | # The most important thing is that files don't get lost, especially archives |
1115 | | - $dbw->commit(); |
| 1115 | + $dbw->commit( __METHOD__ ); |
1116 | 1116 | |
1117 | 1117 | # Save to cache and purge the squid |
1118 | 1118 | # We shall not saveToCache before the commit since otherwise |
— | — | @@ -1409,7 +1409,7 @@ |
1410 | 1410 | $dbw = $this->repo->getMasterDB(); |
1411 | 1411 | |
1412 | 1412 | if ( !$this->locked ) { |
1413 | | - $dbw->begin(); |
| 1413 | + $dbw->begin( __METHOD__ ); |
1414 | 1414 | $this->locked++; |
1415 | 1415 | } |
1416 | 1416 | |
— | — | @@ -1425,7 +1425,7 @@ |
1426 | 1426 | --$this->locked; |
1427 | 1427 | if ( !$this->locked ) { |
1428 | 1428 | $dbw = $this->repo->getMasterDB(); |
1429 | | - $dbw->commit(); |
| 1429 | + $dbw->commit( __METHOD__ ); |
1430 | 1430 | } |
1431 | 1431 | } |
1432 | 1432 | } |
— | — | @@ -1436,7 +1436,7 @@ |
1437 | 1437 | function unlockAndRollback() { |
1438 | 1438 | $this->locked = false; |
1439 | 1439 | $dbw = $this->repo->getMasterDB(); |
1440 | | - $dbw->rollback(); |
| 1440 | + $dbw->rollback( __METHOD__ ); |
1441 | 1441 | } |
1442 | 1442 | } // LocalFile class |
1443 | 1443 | |
— | — | @@ -2215,17 +2215,17 @@ |
2216 | 2216 | return $statusMove; |
2217 | 2217 | } |
2218 | 2218 | |
2219 | | - $this->db->begin(); |
| 2219 | + $this->db->begin( __METHOD__ ); |
2220 | 2220 | $statusDb = $this->doDBUpdates(); |
2221 | 2221 | wfDebugLog( 'imagemove', "Renamed {$this->file->getName()} in database: {$statusDb->successCount} successes, {$statusDb->failCount} failures" ); |
2222 | 2222 | if ( !$statusDb->isGood() ) { |
2223 | | - $this->db->rollback(); |
| 2223 | + $this->db->rollback( __METHOD__ ); |
2224 | 2224 | // Something went wrong with the DB updates, so remove the target files |
2225 | 2225 | $this->cleanupTarget( $triplets ); |
2226 | 2226 | $statusDb->ok = false; |
2227 | 2227 | return $statusDb; |
2228 | 2228 | } |
2229 | | - $this->db->commit(); |
| 2229 | + $this->db->commit( __METHOD__ ); |
2230 | 2230 | |
2231 | 2231 | // Everything went ok, remove the source files |
2232 | 2232 | $this->cleanupSource( $triplets ); |
Index: trunk/phase3/includes/installer/MysqlInstaller.php |
— | — | @@ -514,9 +514,9 @@ |
515 | 515 | $fullName = $this->buildFullUserName( $dbUser, $host ); |
516 | 516 | if( !$this->userDefinitelyExists( $dbUser, $host ) ) { |
517 | 517 | try{ |
518 | | - $this->db->begin(); |
| 518 | + $this->db->begin( __METHOD__ ); |
519 | 519 | $this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ ); |
520 | | - $this->db->commit(); |
| 520 | + $this->db->commit( __METHOD__ ); |
521 | 521 | $grantableNames[] = $fullName; |
522 | 522 | } catch( DBQueryError $dqe ) { |
523 | 523 | if( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) { |
— | — | @@ -544,11 +544,11 @@ |
545 | 545 | $dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*'; |
546 | 546 | foreach( $grantableNames as $name ) { |
547 | 547 | try { |
548 | | - $this->db->begin(); |
| 548 | + $this->db->begin( __METHOD__ ); |
549 | 549 | $this->db->query( "GRANT ALL PRIVILEGES ON $dbAllTables TO $name", __METHOD__ ); |
550 | | - $this->db->commit(); |
| 550 | + $this->db->commit( __METHOD__ ); |
551 | 551 | } catch( DBQueryError $dqe ) { |
552 | | - $this->db->rollback(); |
| 552 | + $this->db->rollback( __METHOD__ ); |
553 | 553 | $status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getText() ); |
554 | 554 | } |
555 | 555 | } |
Index: trunk/phase3/includes/installer/PostgresInstaller.php |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | */ |
149 | 149 | $conn = $status->value; |
150 | 150 | $conn->clearFlag( DBO_TRX ); |
151 | | - $conn->commit(); |
| 151 | + $conn->commit( __METHOD__ ); |
152 | 152 | $this->pgConns[$type] = $conn; |
153 | 153 | } |
154 | 154 | return $status; |
— | — | @@ -478,7 +478,7 @@ |
479 | 479 | } |
480 | 480 | |
481 | 481 | function commitChanges() { |
482 | | - $this->db->commit(); |
| 482 | + $this->db->commit( __METHOD__ ); |
483 | 483 | return Status::newGood(); |
484 | 484 | } |
485 | 485 | |
Index: trunk/phase3/includes/job/JobQueue.php |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | |
58 | 58 | $dbw = wfGetDB( DB_MASTER ); |
59 | 59 | |
60 | | - $dbw->begin(); |
| 60 | + $dbw->begin( __METHOD__ ); |
61 | 61 | |
62 | 62 | $row = $dbw->selectRow( |
63 | 63 | 'job', |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | ); |
69 | 69 | |
70 | 70 | if ( $row === false ) { |
71 | | - $dbw->commit(); |
| 71 | + $dbw->commit( __METHOD__ ); |
72 | 72 | wfProfileOut( __METHOD__ ); |
73 | 73 | return false; |
74 | 74 | } |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | /* Ensure we "own" this row */ |
77 | 77 | $dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ ); |
78 | 78 | $affected = $dbw->affectedRows(); |
79 | | - $dbw->commit(); |
| 79 | + $dbw->commit( __METHOD__ ); |
80 | 80 | |
81 | 81 | if ( $affected == 0 ) { |
82 | 82 | wfProfileOut( __METHOD__ ); |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | $dbw = wfGetDB( DB_MASTER ); |
148 | 148 | $dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ ); |
149 | 149 | $affected = $dbw->affectedRows(); |
150 | | - $dbw->commit(); |
| 150 | + $dbw->commit( __METHOD__ ); |
151 | 151 | |
152 | 152 | if ( !$affected ) { |
153 | 153 | // Failed, someone else beat us to it |
— | — | @@ -170,7 +170,7 @@ |
171 | 171 | // Delete the random row |
172 | 172 | $dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ ); |
173 | 173 | $affected = $dbw->affectedRows(); |
174 | | - $dbw->commit(); |
| 174 | + $dbw->commit( __METHOD__ ); |
175 | 175 | |
176 | 176 | if ( !$affected ) { |
177 | 177 | // Random job gone before we exclusively deleted it |
— | — | @@ -260,16 +260,16 @@ |
261 | 261 | $rows[] = $job->insertFields(); |
262 | 262 | if ( count( $rows ) >= 50 ) { |
263 | 263 | # Do a small transaction to avoid slave lag |
264 | | - $dbw->begin(); |
| 264 | + $dbw->begin( __METHOD__ ); |
265 | 265 | $dbw->insert( 'job', $rows, __METHOD__, 'IGNORE' ); |
266 | | - $dbw->commit(); |
| 266 | + $dbw->commit( __METHOD__ ); |
267 | 267 | $rows = array(); |
268 | 268 | } |
269 | 269 | } |
270 | 270 | if ( $rows ) { // last chunk |
271 | | - $dbw->begin(); |
| 271 | + $dbw->begin( __METHOD__ ); |
272 | 272 | $dbw->insert( 'job', $rows, __METHOD__, 'IGNORE' ); |
273 | | - $dbw->commit(); |
| 273 | + $dbw->commit( __METHOD__ ); |
274 | 274 | } |
275 | 275 | wfIncrStats( 'job-insert', count( $jobs ) ); |
276 | 276 | } |
— | — | @@ -369,10 +369,10 @@ |
370 | 370 | $fields = $this->insertFields(); |
371 | 371 | unset( $fields['job_id'] ); |
372 | 372 | $dbw = wfGetDB( DB_MASTER ); |
373 | | - $dbw->begin(); |
| 373 | + $dbw->begin( __METHOD__ ); |
374 | 374 | $dbw->delete( 'job', $fields, __METHOD__ ); |
375 | 375 | $affected = $dbw->affectedRows(); |
376 | | - $dbw->commit(); |
| 376 | + $dbw->commit( __METHOD__ ); |
377 | 377 | if ( $affected ) { |
378 | 378 | wfIncrStats( 'job-dup-delete', $affected ); |
379 | 379 | } |