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:
parent
2b39a77fd8
commit
8bbc724210
2 changed files with 34 additions and 24 deletions
|
@ -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);
|
||||||
|
|
|
@ -89,11 +89,16 @@ 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
|
||||||
|
// of a "user.query" call in client version 5.
|
||||||
|
4 => true,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($supported_versions[$client_version])) {
|
||||||
if ($server_version < $client_version) {
|
if ($server_version < $client_version) {
|
||||||
$ex = new ConduitException('ERR-BAD-VERSION');
|
$ex = new ConduitException('ERR-BAD-VERSION');
|
||||||
$ex->setErrorDescription(
|
$ex->setErrorDescription(
|
||||||
|
|
Loading…
Reference in a new issue