1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

"arc upgrade" (server changes)

Summary: When the server version is ahead of the client version, send a more exciting error!!!

Test Plan: omg~~~

Reviewers: nh, Makinde, btrahan, jungejason

Reviewed By: nh

CC: aran

Differential Revision: https://secure.phabricator.com/D2436
This commit is contained in:
epriestley 2012-05-09 10:01:46 -07:00
parent 872845cc6c
commit ed34402313

View file

@ -52,7 +52,10 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
public function defineErrorTypes() { public function defineErrorTypes() {
return array( return array(
"ERR-BAD-VERSION" => "ERR-BAD-VERSION" =>
"Client/server version mismatch. Update your client.", "Client/server version mismatch. Upgrade your server or downgrade ".
"your client.",
"NEW-ARC-VERSION" =>
"Client/server version mismatch. Upgrade your client.",
"ERR-UNKNOWN-CLIENT" => "ERR-UNKNOWN-CLIENT" =>
"Client is unknown.", "Client is unknown.",
"ERR-INVALID-USER" => "ERR-INVALID-USER" =>
@ -91,17 +94,20 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
case $server_version: case $server_version:
break; break;
default: default:
$ex = new ConduitException('ERR-BAD-VERSION');
if ($server_version < $client_version) { if ($server_version < $client_version) {
$upgrade = "Upgrade your Phabricator install."; $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 { } else {
$upgrade = "Upgrade your 'arc' client."; $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}).");
} }
$ex->setErrorDescription(
"Your 'arc' client version is '{$client_version}', but this ".
"server expects version '{$server_version}'. {$upgrade}");
throw $ex; throw $ex;
} }
break; break;