Index: trunk/extensions/CodeReview/repopulateCodePaths.php |
— | — | @@ -42,20 +42,19 @@ |
43 | 43 | $res = $dbr->select( 'code_paths', '*', array( 'cp_rev_id' => $revisions, 'cp_repo_id' => $repo->getId() ), |
44 | 44 | __METHOD__ ); |
45 | 45 | |
46 | | - $data = array(); |
| 46 | + $dbw = wfGetDB( DB_MASTER ); |
| 47 | + $dbw->begin(); |
| 48 | + |
47 | 49 | foreach ( $res as $row ) { |
48 | 50 | $fragments = CodeRevision::getPathFragments( |
49 | 51 | array( array( 'path' => $row->cp_path, 'action' => $row->cp_action ) ) ); |
50 | | - $data = array_merge( $data, $fragments ); |
51 | 52 | |
| 53 | + CodeRevision::insertPaths( $dbw, $fragments, $repo->getId(), $row->cp_rev_id ); |
| 54 | + |
52 | 55 | $this->output( "r{$row->cp_rev_id}, path: " . $row->cp_path . " Fragments: " . |
53 | 56 | count( $fragments ) . "\n" ); |
54 | 57 | } |
55 | 58 | |
56 | | - $dbw = wfGetDB( DB_MASTER ); |
57 | | - $dbw->begin(); |
58 | | - $this->output( "Commiting paths..." ); |
59 | | - CodeRevision::insertPaths( $dbw, $data, $repo->getId(), $row->cp_rev_id ); |
60 | 59 | $dbw->commit(); |
61 | 60 | |
62 | 61 | $this->output( "Done!\n" ); |