1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-02 02:40:58 +01:00

Bump Conduit server version

Summary:
We introduced a "user.query" call recently which is only about two weeks old. Bump versions so users get a forced upgrade.

Also, we raise a fairly confusing message when the user calls a nonexistent method. This is not the intent; `class_exists()` throws. Tailor this exception more carefully.

Test Plan:
  - Ran `echo {} | arc call-conduit derp.derp`, got a better exception.
  - Bumped version, ran `arc list`, got told to upgrade.

Reviewers: indiefan, nh, vrana, btrahan, jungejason, Makinde

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D2527
This commit is contained in:
epriestley 2012-05-21 16:43:43 -07:00
parent 2b39a77fd8
commit 8bbc724210
2 changed files with 34 additions and 24 deletions

View file

@ -48,11 +48,16 @@ final class PhabricatorConduitAPIController
try { try {
if (!class_exists($method_class)) { $ok = false;
try {
$ok = class_exists($method_class);
} catch (Exception $ex) {
// Discard, we provide a more specific exception below.
}
if (!$ok) {
throw new Exception( throw new Exception(
"Unable to load the implementation class for method '{$method}'. ". "Conduit method '{$method}' does not exist.");
"You may have misspelled the method, need to define ".
"'{$method_class}', or need to run 'arc build'.");
} }
$class_info = new ReflectionClass($method_class); $class_info = new ReflectionClass($method_class);

View file

@ -89,26 +89,31 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
switch ($client) { switch ($client) {
case 'arc': case 'arc':
$server_version = 4; $server_version = 5;
switch ($client_version) { $supported_versions = array(
case $server_version: $server_version => true,
break; // NOTE: Version 5 of the server can support either version 4 or
default: // version 5 of the client; the breaking change was the introduction
if ($server_version < $client_version) { // of a "user.query" call in client version 5.
$ex = new ConduitException('ERR-BAD-VERSION'); 4 => true,
$ex->setErrorDescription( );
"Your 'arc' client version is '{$client_version}', which ".
"is newer than the server version, '{$server_version}'. ". if (empty($supported_versions[$client_version])) {
"Upgrade your Phabricator install."); if ($server_version < $client_version) {
} else { $ex = new ConduitException('ERR-BAD-VERSION');
$ex = new ConduitException('NEW-ARC-VERSION'); $ex->setErrorDescription(
$ex->setErrorDescription( "Your 'arc' client version is '{$client_version}', which ".
"A new version of arc is available! You need to upgrade ". "is newer than the server version, '{$server_version}'. ".
"to connect to this server (you are running version ". "Upgrade your Phabricator install.");
"{$client_version}, the server is running version ". } else {
"{$server_version})."); $ex = new ConduitException('NEW-ARC-VERSION');
} $ex->setErrorDescription(
throw $ex; "A new version of arc is available! You need to upgrade ".
"to connect to this server (you are running version ".
"{$client_version}, the server is running version ".
"{$server_version}).");
}
throw $ex;
} }
break; break;
default: default: