mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-09 10:54:48 +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,11 +89,16 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
|
|||
|
||||
switch ($client) {
|
||||
case 'arc':
|
||||
$server_version = 4;
|
||||
switch ($client_version) {
|
||||
case $server_version:
|
||||
break;
|
||||
default:
|
||||
$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(
|
||||
|
|
Loading…
Add table
Reference in a new issue