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

Remove all references to the Conduit ConnectionLog

Summary:
Ref T5955, T9980, T9982.

We currently store two types of Conduit logs: //connection// logs and //method// logs.

Originally, Conduit worked like web logins: you'd call `conduit.connect` and then get a session back. This approach still works, but new clients don't use it and it will probably stop working eventually after T5955 is further along.

There was no real reason for things to work like this and no other API in the world does, I think it was just slightly easier to implement back in 2011.

This table was used to group up related calls in a UI long ago, I think, but that got deleted at some point. In any case, it serves no purpose in modern Phabricator.

Test Plan: `grep`

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T5955, T9980, T9982

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

+2 -71
-4
src/__phutil_library_map__.php
··· 227 227 'ConduitCall' => 'applications/conduit/call/ConduitCall.php', 228 228 'ConduitCallTestCase' => 'applications/conduit/call/__tests__/ConduitCallTestCase.php', 229 229 'ConduitConnectConduitAPIMethod' => 'applications/conduit/method/ConduitConnectConduitAPIMethod.php', 230 - 'ConduitConnectionGarbageCollector' => 'applications/conduit/garbagecollector/ConduitConnectionGarbageCollector.php', 231 230 'ConduitEpochParameterType' => 'applications/conduit/parametertype/ConduitEpochParameterType.php', 232 231 'ConduitException' => 'applications/conduit/protocol/exception/ConduitException.php', 233 232 'ConduitGetCapabilitiesConduitAPIMethod' => 'applications/conduit/method/ConduitGetCapabilitiesConduitAPIMethod.php', ··· 1884 1883 'PhabricatorConduitAPIController' => 'applications/conduit/controller/PhabricatorConduitAPIController.php', 1885 1884 'PhabricatorConduitApplication' => 'applications/conduit/application/PhabricatorConduitApplication.php', 1886 1885 'PhabricatorConduitCertificateToken' => 'applications/conduit/storage/PhabricatorConduitCertificateToken.php', 1887 - 'PhabricatorConduitConnectionLog' => 'applications/conduit/storage/PhabricatorConduitConnectionLog.php', 1888 1886 'PhabricatorConduitConsoleController' => 'applications/conduit/controller/PhabricatorConduitConsoleController.php', 1889 1887 'PhabricatorConduitController' => 'applications/conduit/controller/PhabricatorConduitController.php', 1890 1888 'PhabricatorConduitDAO' => 'applications/conduit/storage/PhabricatorConduitDAO.php', ··· 4089 4087 'ConduitCall' => 'Phobject', 4090 4088 'ConduitCallTestCase' => 'PhabricatorTestCase', 4091 4089 'ConduitConnectConduitAPIMethod' => 'ConduitAPIMethod', 4092 - 'ConduitConnectionGarbageCollector' => 'PhabricatorGarbageCollector', 4093 4090 'ConduitEpochParameterType' => 'ConduitListParameterType', 4094 4091 'ConduitException' => 'Exception', 4095 4092 'ConduitGetCapabilitiesConduitAPIMethod' => 'ConduitAPIMethod', ··· 5999 5996 'PhabricatorConduitAPIController' => 'PhabricatorConduitController', 6000 5997 'PhabricatorConduitApplication' => 'PhabricatorApplication', 6001 5998 'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO', 6002 - 'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO', 6003 5999 'PhabricatorConduitConsoleController' => 'PhabricatorConduitController', 6004 6000 'PhabricatorConduitController' => 'PhabricatorController', 6005 6001 'PhabricatorConduitDAO' => 'PhabricatorLiskDAO',
-30
src/applications/conduit/garbagecollector/ConduitConnectionGarbageCollector.php
··· 1 - <?php 2 - 3 - final class ConduitConnectionGarbageCollector 4 - extends PhabricatorGarbageCollector { 5 - 6 - const COLLECTORCONST = 'conduit.connections'; 7 - 8 - public function getCollectorName() { 9 - return pht('Conduit Connections'); 10 - } 11 - 12 - public function getDefaultRetentionPolicy() { 13 - return phutil_units('180 days in seconds'); 14 - } 15 - 16 - protected function collectGarbage() { 17 - $table = new PhabricatorConduitConnectionLog(); 18 - $conn_w = $table->establishConnection('w'); 19 - 20 - queryfx( 21 - $conn_w, 22 - 'DELETE FROM %T WHERE dateCreated < %d 23 - ORDER BY dateCreated ASC LIMIT 100', 24 - $table->getTableName(), 25 - $this->getGarbageEpoch()); 26 - 27 - return ($conn_w->getAffectedRows() == 100); 28 - } 29 - 30 - }
+1 -9
src/applications/conduit/method/ConduitConnectConduitAPIMethod.php
··· 63 63 ->truncateString($client_description); 64 64 $username = (string)$request->getValue('user'); 65 65 66 - // Log the connection, regardless of the outcome of checks below. 67 - $connection = new PhabricatorConduitConnectionLog(); 68 - $connection->setClient($client); 69 - $connection->setClientVersion($client_version); 70 - $connection->setClientDescription($client_description); 71 - $connection->setUsername($username); 72 - $connection->save(); 73 - 74 66 switch ($client) { 75 67 case 'arc': 76 68 $server_version = 6; ··· 154 146 } 155 147 156 148 return array( 157 - 'connectionID' => $connection->getID(), 149 + 'connectionID' => mt_rand(), 158 150 'sessionKey' => $session_key, 159 151 'userPHID' => $user->getPHID(), 160 152 );
-26
src/applications/conduit/storage/PhabricatorConduitConnectionLog.php
··· 1 - <?php 2 - 3 - final class PhabricatorConduitConnectionLog extends PhabricatorConduitDAO { 4 - 5 - protected $client; 6 - protected $clientVersion; 7 - protected $clientDescription; 8 - protected $username; 9 - 10 - protected function getConfiguration() { 11 - return array( 12 - self::CONFIG_COLUMN_SCHEMA => array( 13 - 'client' => 'text255?', 14 - 'clientVersion' => 'text255?', 15 - 'clientDescription' => 'text255?', 16 - 'username' => 'text255?', 17 - ), 18 - self::CONFIG_KEY_SCHEMA => array( 19 - 'key_created' => array( 20 - 'columns' => array('dateCreated'), 21 - ), 22 - ), 23 - ) + parent::getConfiguration(); 24 - } 25 - 26 - }
+1 -2
src/docs/tech/conduit.diviner
··· 46 46 Console", implemented by @{class:PhabricatorConduitConsoleController} at 47 47 `/conduit/`. 48 48 49 - A log of connections and calls is stored by 50 - @{class:PhabricatorConduitConnectionLog} and 49 + A log of connections and calls is stored in 51 50 @{class:PhabricatorConduitMethodCallLog}, and can be accessed on the web via 52 51 @{class:PhabricatorConduitLogController} at `/conduit/log/`. 53 52