mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 20:40:56 +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:
parent
2b39a77fd8
commit
8bbc724210
2 changed files with 34 additions and 24 deletions
|
@ -48,11 +48,16 @@ final class PhabricatorConduitAPIController
|
|||
|
||||
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(
|
||||
"Unable to load the implementation class for method '{$method}'. ".
|
||||
"You may have misspelled the method, need to define ".
|
||||
"'{$method_class}', or need to run 'arc build'.");
|
||||
"Conduit method '{$method}' does not exist.");
|
||||
}
|
||||
|
||||
$class_info = new ReflectionClass($method_class);
|
||||
|
|
|
@ -89,26 +89,31 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
|
|||
|
||||
switch ($client) {
|
||||
case 'arc':
|
||||
$server_version = 4;
|
||||
switch ($client_version) {
|
||||
case $server_version:
|
||||
break;
|
||||
default:
|
||||
if ($server_version < $client_version) {
|
||||
$ex = new ConduitException('ERR-BAD-VERSION');
|
||||
$ex->setErrorDescription(
|
||||
"Your 'arc' client version is '{$client_version}', which ".
|
||||
"is newer than the server version, '{$server_version}'. ".
|
||||
"Upgrade your Phabricator install.");
|
||||
} else {
|
||||
$ex = new ConduitException('NEW-ARC-VERSION');
|
||||
$ex->setErrorDescription(
|
||||
"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;
|
||||
$server_version = 5;
|
||||
$supported_versions = array(
|
||||
$server_version => true,
|
||||
// NOTE: Version 5 of the server can support either version 4 or
|
||||
// version 5 of the client; the breaking change was the introduction
|
||||
// of a "user.query" call in client version 5.
|
||||
4 => true,
|
||||
);
|
||||
|
||||
if (empty($supported_versions[$client_version])) {
|
||||
if ($server_version < $client_version) {
|
||||
$ex = new ConduitException('ERR-BAD-VERSION');
|
||||
$ex->setErrorDescription(
|
||||
"Your 'arc' client version is '{$client_version}', which ".
|
||||
"is newer than the server version, '{$server_version}'. ".
|
||||
"Upgrade your Phabricator install.");
|
||||
} else {
|
||||
$ex = new ConduitException('NEW-ARC-VERSION');
|
||||
$ex->setErrorDescription(
|
||||
"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;
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue