@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.

Assign PHIDs to PushLogs

Summary: Ref T4195. We need these in Herald, since HeraldTranscripts need to refer to a PHID which they acted upon.

Test Plan:
Ran migration, got PHIDs:

mysql> select phid from repository_pushlog limit 3;
+--------------------------------+
| phid |
+--------------------------------+
| PHID-PSHL-25jnc6cjgzw5rwqgmr7r |
| PHID-PSHL-2vrvmtslkrj5yv7nxsv2 |
| PHID-PSHL-34x262zkrwoka6mplony |
+--------------------------------+
3 rows in set (0.00 sec)

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4195

Differential Revision: https://secure.phabricator.com/D7780

+88
+2
resources/sql/patches/20131217.pushlogphid.1.col.sql
··· 1 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 2 + ADD phid VARCHAR(64) NOT NULL COLLATE utf8_bin AFTER id;
+20
resources/sql/patches/20131217.pushlogphid.2.mig.php
··· 1 + <?php 2 + 3 + $table = new PhabricatorRepositoryPushLog(); 4 + $conn_w = $table->establishConnection('w'); 5 + 6 + echo "Assigning PHIDs to push logs...\n"; 7 + 8 + $logs = new LiskMigrationIterator($table); 9 + foreach ($logs as $log) { 10 + $id = $log->getID(); 11 + echo "Updating {$id}...\n"; 12 + queryfx( 13 + $conn_w, 14 + 'UPDATE %T SET phid = %s WHERE id = %d', 15 + $table->getTableName(), 16 + $log->generatePHID(), 17 + $id); 18 + } 19 + 20 + echo "Done.\n";
+2
resources/sql/patches/20131217.pushlogphid.3.key.sql
··· 1 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 2 + ADD UNIQUE KEY `key_phid` (phid);
+2
src/__phutil_library_map__.php
··· 1798 1798 'PhabricatorRepositoryPHIDTypeArcanistProject' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php', 1799 1799 'PhabricatorRepositoryPHIDTypeCommit' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php', 1800 1800 'PhabricatorRepositoryPHIDTypeMirror' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeMirror.php', 1801 + 'PhabricatorRepositoryPHIDTypePushLog' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypePushLog.php', 1801 1802 'PhabricatorRepositoryPHIDTypeRepository' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php', 1802 1803 'PhabricatorRepositoryPullEngine' => 'applications/repository/engine/PhabricatorRepositoryPullEngine.php', 1803 1804 'PhabricatorRepositoryPullLocalDaemon' => 'applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php', ··· 4363 4364 'PhabricatorRepositoryPHIDTypeArcanistProject' => 'PhabricatorPHIDType', 4364 4365 'PhabricatorRepositoryPHIDTypeCommit' => 'PhabricatorPHIDType', 4365 4366 'PhabricatorRepositoryPHIDTypeMirror' => 'PhabricatorPHIDType', 4367 + 'PhabricatorRepositoryPHIDTypePushLog' => 'PhabricatorPHIDType', 4366 4368 'PhabricatorRepositoryPHIDTypeRepository' => 'PhabricatorPHIDType', 4367 4369 'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine', 4368 4370 'PhabricatorRepositoryPullLocalDaemon' => 'PhabricatorDaemon',
+44
src/applications/repository/phid/PhabricatorRepositoryPHIDTypePushLog.php
··· 1 + <?php 2 + 3 + final class PhabricatorRepositoryPHIDTypePushLog 4 + extends PhabricatorPHIDType { 5 + 6 + const TYPECONST = 'PSHL'; 7 + 8 + public function getTypeConstant() { 9 + return self::TYPECONST; 10 + } 11 + 12 + public function getTypeName() { 13 + return pht('Push Log'); 14 + } 15 + 16 + public function newObject() { 17 + return new PhabricatorRepositoryPushLog(); 18 + } 19 + 20 + protected function buildQueryForObjects( 21 + PhabricatorObjectQuery $query, 22 + array $phids) { 23 + 24 + return id(new PhabricatorRepositoryPushLogQuery()) 25 + ->withPHIDs($phids); 26 + } 27 + 28 + public function loadHandles( 29 + PhabricatorHandleQuery $query, 30 + array $handles, 31 + array $objects) { 32 + 33 + foreach ($handles as $phid => $handle) { 34 + $log = $objects[$phid]; 35 + 36 + $handle->setName(pht('Push Log %d', $log->getID())); 37 + } 38 + } 39 + 40 + public function canLoadNamedObject($name) { 41 + return false; 42 + } 43 + 44 + }
+6
src/applications/repository/storage/PhabricatorRepositoryPushLog.php
··· 57 57 58 58 public function getConfiguration() { 59 59 return array( 60 + self::CONFIG_AUX_PHID => true, 60 61 self::CONFIG_TIMESTAMPS => false, 61 62 ) + parent::getConfiguration(); 63 + } 64 + 65 + public function generatePHID() { 66 + return PhabricatorPHID::generateNewPHID( 67 + PhabricatorRepositoryPHIDTypePushLog::TYPECONST); 62 68 } 63 69 64 70 public function attachRepository(PhabricatorRepository $repository) {
+12
src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
··· 1832 1832 'type' => 'sql', 1833 1833 'name' => $this->getPatchPath('20131211.phragmentedges.sql'), 1834 1834 ), 1835 + '20131217.pushlogphid.1.col.sql' => array( 1836 + 'type' => 'sql', 1837 + 'name' => $this->getPatchPath('20131217.pushlogphid.1.col.sql'), 1838 + ), 1839 + '20131217.pushlogphid.2.mig.php' => array( 1840 + 'type' => 'php', 1841 + 'name' => $this->getPatchPath('20131217.pushlogphid.2.mig.php'), 1842 + ), 1843 + '20131217.pushlogphid.3.key.sql' => array( 1844 + 'type' => 'sql', 1845 + 'name' => $this->getPatchPath('20131217.pushlogphid.3.key.sql'), 1846 + ), 1835 1847 ); 1836 1848 } 1837 1849 }