From 0692115953faef91e857e5ab43fe52828d1fc05b Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 14 Dec 2015 12:47:09 -0800 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 4 --- .../ConduitConnectionGarbageCollector.php | 30 ------------------- .../method/ConduitConnectConduitAPIMethod.php | 10 +------ .../PhabricatorConduitConnectionLog.php | 26 ---------------- src/docs/tech/conduit.diviner | 3 +- 5 files changed, 2 insertions(+), 71 deletions(-) delete mode 100644 src/applications/conduit/garbagecollector/ConduitConnectionGarbageCollector.php delete mode 100644 src/applications/conduit/storage/PhabricatorConduitConnectionLog.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ecf14c6300..89a84669c6 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -227,7 +227,6 @@ phutil_register_library_map(array( 'ConduitCall' => 'applications/conduit/call/ConduitCall.php', 'ConduitCallTestCase' => 'applications/conduit/call/__tests__/ConduitCallTestCase.php', 'ConduitConnectConduitAPIMethod' => 'applications/conduit/method/ConduitConnectConduitAPIMethod.php', - 'ConduitConnectionGarbageCollector' => 'applications/conduit/garbagecollector/ConduitConnectionGarbageCollector.php', 'ConduitEpochParameterType' => 'applications/conduit/parametertype/ConduitEpochParameterType.php', 'ConduitException' => 'applications/conduit/protocol/exception/ConduitException.php', 'ConduitGetCapabilitiesConduitAPIMethod' => 'applications/conduit/method/ConduitGetCapabilitiesConduitAPIMethod.php', @@ -1884,7 +1883,6 @@ phutil_register_library_map(array( 'PhabricatorConduitAPIController' => 'applications/conduit/controller/PhabricatorConduitAPIController.php', 'PhabricatorConduitApplication' => 'applications/conduit/application/PhabricatorConduitApplication.php', 'PhabricatorConduitCertificateToken' => 'applications/conduit/storage/PhabricatorConduitCertificateToken.php', - 'PhabricatorConduitConnectionLog' => 'applications/conduit/storage/PhabricatorConduitConnectionLog.php', 'PhabricatorConduitConsoleController' => 'applications/conduit/controller/PhabricatorConduitConsoleController.php', 'PhabricatorConduitController' => 'applications/conduit/controller/PhabricatorConduitController.php', 'PhabricatorConduitDAO' => 'applications/conduit/storage/PhabricatorConduitDAO.php', @@ -4089,7 +4087,6 @@ phutil_register_library_map(array( 'ConduitCall' => 'Phobject', 'ConduitCallTestCase' => 'PhabricatorTestCase', 'ConduitConnectConduitAPIMethod' => 'ConduitAPIMethod', - 'ConduitConnectionGarbageCollector' => 'PhabricatorGarbageCollector', 'ConduitEpochParameterType' => 'ConduitListParameterType', 'ConduitException' => 'Exception', 'ConduitGetCapabilitiesConduitAPIMethod' => 'ConduitAPIMethod', @@ -5999,7 +5996,6 @@ phutil_register_library_map(array( 'PhabricatorConduitAPIController' => 'PhabricatorConduitController', 'PhabricatorConduitApplication' => 'PhabricatorApplication', 'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO', - 'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO', 'PhabricatorConduitConsoleController' => 'PhabricatorConduitController', 'PhabricatorConduitController' => 'PhabricatorController', 'PhabricatorConduitDAO' => 'PhabricatorLiskDAO', diff --git a/src/applications/conduit/garbagecollector/ConduitConnectionGarbageCollector.php b/src/applications/conduit/garbagecollector/ConduitConnectionGarbageCollector.php deleted file mode 100644 index f87fc57572..0000000000 --- a/src/applications/conduit/garbagecollector/ConduitConnectionGarbageCollector.php +++ /dev/null @@ -1,30 +0,0 @@ -establishConnection('w'); - - queryfx( - $conn_w, - 'DELETE FROM %T WHERE dateCreated < %d - ORDER BY dateCreated ASC LIMIT 100', - $table->getTableName(), - $this->getGarbageEpoch()); - - return ($conn_w->getAffectedRows() == 100); - } - -} diff --git a/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php b/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php index 9f57365d38..8119deb860 100644 --- a/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php @@ -63,14 +63,6 @@ final class ConduitConnectConduitAPIMethod extends ConduitAPIMethod { ->truncateString($client_description); $username = (string)$request->getValue('user'); - // Log the connection, regardless of the outcome of checks below. - $connection = new PhabricatorConduitConnectionLog(); - $connection->setClient($client); - $connection->setClientVersion($client_version); - $connection->setClientDescription($client_description); - $connection->setUsername($username); - $connection->save(); - switch ($client) { case 'arc': $server_version = 6; @@ -154,7 +146,7 @@ final class ConduitConnectConduitAPIMethod extends ConduitAPIMethod { } return array( - 'connectionID' => $connection->getID(), + 'connectionID' => mt_rand(), 'sessionKey' => $session_key, 'userPHID' => $user->getPHID(), ); diff --git a/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php b/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php deleted file mode 100644 index 498bb6ecfa..0000000000 --- a/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php +++ /dev/null @@ -1,26 +0,0 @@ - array( - 'client' => 'text255?', - 'clientVersion' => 'text255?', - 'clientDescription' => 'text255?', - 'username' => 'text255?', - ), - self::CONFIG_KEY_SCHEMA => array( - 'key_created' => array( - 'columns' => array('dateCreated'), - ), - ), - ) + parent::getConfiguration(); - } - -} diff --git a/src/docs/tech/conduit.diviner b/src/docs/tech/conduit.diviner index b8b0f9da93..af6c5b12b9 100644 --- a/src/docs/tech/conduit.diviner +++ b/src/docs/tech/conduit.diviner @@ -46,8 +46,7 @@ There is a web interface for viewing and testing Conduit called the "Conduit Console", implemented by @{class:PhabricatorConduitConsoleController} at `/conduit/`. -A log of connections and calls is stored by -@{class:PhabricatorConduitConnectionLog} and +A log of connections and calls is stored in @{class:PhabricatorConduitMethodCallLog}, and can be accessed on the web via @{class:PhabricatorConduitLogController} at `/conduit/log/`.