[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 echo "Updating old commit authors...\n"; 4 $table = new PhabricatorRepositoryCommit(); 5 $table->openTransaction(); 6 7 $conn = $table->establishConnection('w'); 8 $data = new PhabricatorRepositoryCommitData(); 9 $commits = queryfx_all( 10 $conn, 11 'SELECT c.id id, c.authorPHID authorPHID, d.commitDetails details 12 FROM %T c JOIN %T d ON d.commitID = c.id 13 WHERE c.authorPHID IS NULL 14 FOR UPDATE', 15 $table->getTableName(), 16 $data->getTableName()); 17 18 foreach ($commits as $commit) { 19 $id = $commit['id']; 20 $details = json_decode($commit['details'], true); 21 $author_phid = idx($details, 'authorPHID'); 22 if ($author_phid) { 23 queryfx( 24 $conn, 25 'UPDATE %T SET authorPHID = %s WHERE id = %d', 26 $table->getTableName(), 27 $author_phid, 28 $id); 29 echo "#{$id}\n"; 30 } 31 } 32 33 $table->saveTransaction(); 34 echo "Done.\n"; 35 36 37 echo "Updating old commit mailKeys...\n"; 38 $table->openTransaction(); 39 40 $commits = queryfx_all( 41 $conn, 42 'SELECT id FROM %T WHERE mailKey = %s FOR UPDATE', 43 $table->getTableName(), 44 ''); 45 46 foreach ($commits as $commit) { 47 $id = $commit['id']; 48 queryfx( 49 $conn, 50 'UPDATE %T SET mailKey = %s WHERE id = %d', 51 $table->getTableName(), 52 Filesystem::readRandomCharacters(20), 53 $id); 54 echo "#{$id}\n"; 55 } 56 57 $table->saveTransaction(); 58 echo "Done.\n";
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |