@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 95 lines 2.4 kB view raw
1<?php 2 3$status_map = array( 4 0 => 'open', 5 1 => 'resolved', 6 2 => 'wontfix', 7 3 => 'invalid', 8 4 => 'duplicate', 9 5 => 'spite', 10); 11 12$conn_w = id(new ManiphestTask())->establishConnection('w'); 13 14echo pht('Migrating tasks to new status constants...')."\n"; 15foreach (new LiskMigrationIterator(new ManiphestTask()) as $task) { 16 $id = $task->getID(); 17 echo pht('Migrating %s...', "T{$id}")."\n"; 18 19 $status = $task->getStatus(); 20 if (isset($status_map[$status])) { 21 queryfx( 22 $conn_w, 23 'UPDATE %T SET status = %s WHERE id = %d', 24 $task->getTableName(), 25 $status_map[$status], 26 $id); 27 } 28} 29 30echo pht('Done.')."\n"; 31 32 33echo pht('Migrating task transactions to new status constants...')."\n"; 34foreach (new LiskMigrationIterator(new ManiphestTransaction()) as $xaction) { 35 $id = $xaction->getID(); 36 echo pht('Migrating %d...', $id)."\n"; 37 38 $xn_type = ManiphestTaskStatusTransaction::TRANSACTIONTYPE; 39 if ($xaction->getTransactionType() == $xn_type) { 40 $old = $xaction->getOldValue(); 41 if ($old !== null && isset($status_map[$old])) { 42 $old = $status_map[$old]; 43 } 44 45 $new = $xaction->getNewValue(); 46 if (isset($status_map[$new])) { 47 $new = $status_map[$new]; 48 } 49 50 queryfx( 51 $conn_w, 52 'UPDATE %T SET oldValue = %s, newValue = %s WHERE id = %d', 53 $xaction->getTableName(), 54 json_encode($old), 55 json_encode($new), 56 $id); 57 } 58} 59echo pht('Done.')."\n"; 60 61$conn_w = id(new PhabricatorSavedQuery())->establishConnection('w'); 62 63echo pht('Migrating searches to new status constants...')."\n"; 64foreach (new LiskMigrationIterator(new PhabricatorSavedQuery()) as $query) { 65 $id = $query->getID(); 66 echo pht('Migrating %d...', $id)."\n"; 67 68 if ($query->getEngineClassName() !== 'ManiphestTaskSearchEngine') { 69 continue; 70 } 71 72 $params = $query->getParameters(); 73 $statuses = idx($params, 'statuses', array()); 74 if ($statuses) { 75 $changed = false; 76 foreach ($statuses as $key => $status) { 77 if (isset($status_map[$status])) { 78 $statuses[$key] = $status_map[$status]; 79 $changed = true; 80 } 81 } 82 83 if ($changed) { 84 $params['statuses'] = $statuses; 85 86 queryfx( 87 $conn_w, 88 'UPDATE %T SET parameters = %s WHERE id = %d', 89 $query->getTableName(), 90 json_encode($params), 91 $id); 92 } 93 } 94} 95echo pht('Done.')."\n";