Replace System::httpExit() by HTTPException throwing
This commit is contained in:
parent
358baa9f62
commit
41f781c52a
39 changed files with 116 additions and 140 deletions
|
@ -22,7 +22,7 @@ function receive_post(App $a)
|
|||
$enabled = intval(Config::get('system', 'diaspora_enabled'));
|
||||
if (!$enabled) {
|
||||
Logger::log('mod-diaspora: disabled');
|
||||
System::httpExit(500);
|
||||
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
|
||||
}
|
||||
|
||||
if (($a->argc == 2) && ($a->argv[1] === 'public')) {
|
||||
|
@ -32,13 +32,13 @@ function receive_post(App $a)
|
|||
$public = false;
|
||||
|
||||
if ($a->argc != 3 || $a->argv[1] !== 'users') {
|
||||
System::httpExit(500);
|
||||
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
|
||||
}
|
||||
$guid = $a->argv[2];
|
||||
|
||||
$importer = DBA::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
|
||||
if (!DBA::isResult($importer)) {
|
||||
System::httpExit(500);
|
||||
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ function receive_post(App $a)
|
|||
if (empty($_POST['xml'])) {
|
||||
$postdata = file_get_contents("php://input");
|
||||
if ($postdata == '') {
|
||||
System::httpExit(500);
|
||||
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
|
||||
}
|
||||
|
||||
Logger::log('mod-diaspora: message is in the new format', Logger::DEBUG);
|
||||
|
@ -71,7 +71,7 @@ function receive_post(App $a)
|
|||
Logger::log('mod-diaspora: decoded msg: ' . print_r($msg, true), Logger::DATA);
|
||||
|
||||
if (!is_array($msg)) {
|
||||
System::httpExit(500);
|
||||
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
|
||||
}
|
||||
|
||||
Logger::log('mod-diaspora: dispatching', Logger::DEBUG);
|
||||
|
@ -83,6 +83,9 @@ function receive_post(App $a)
|
|||
$ret = Diaspora::dispatch($importer, $msg);
|
||||
}
|
||||
|
||||
System::httpExit(($ret) ? 200 : 500);
|
||||
// NOTREACHED
|
||||
if ($ret) {
|
||||
throw new \Friendica\Network\HTTPException\OKException();
|
||||
} else {
|
||||
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue