normalize accounts and check for return in HTTP for moving

This commit is contained in:
Evan Prodromou 2011-01-10 14:56:15 -05:00
parent 4be9fe01bf
commit 566f7c42a5
2 changed files with 16 additions and 0 deletions

View File

@ -57,6 +57,8 @@ class AccountMover
$this->_user = $user;
$this->_profile = $user->getProfile();
$remote = Discovery::normalize($remote);
$oprofile = Ostatus_profile::ensureProfileURI($remote);
if (empty($oprofile)) {

View File

@ -151,5 +151,19 @@ class ActivitySink
$client->setBody($activity->asString(true, true, true));
$response = $client->send();
$status = $response->getStatus();
$reason = $response->getReasonPhrase();
if ($status >= 200 && $status < 300) {
return true;
} else if ($status >= 400 && $status < 500) {
throw new ClientException("{$url} {$status} {$reason}");
} else if ($status >= 500 && $status < 600) {
throw new ServerException("{$url} {$status} {$reason}");
} else {
// That's unexpected.
throw new Exception("{$url} {$status} {$reason}");
}
}
}