fix: check for database connection and podcasts table existence before redirecting to install

fix signature regex
This commit is contained in:
Yassine Doghri 2021-06-10 13:18:58 +00:00
commit eb74e81c3d
No known key found for this signature in database
GPG key ID: 3E7F89498B960C9F
6 changed files with 22 additions and 29 deletions

View file

@ -39,29 +39,25 @@ class NoteController extends ActivityPubNoteController
public function _remap(string $method, string ...$params): mixed
{
if (count($params) < 2) {
throw PageNotFoundException::forPageNotFound();
}
if (
($this->podcast = (new PodcastModel())->getPodcastByName($params[0])) === null
($podcast = (new PodcastModel())->getPodcastByName($params[0],)) === null
) {
throw PageNotFoundException::forPageNotFound();
}
$this->podcast = $podcast;
$this->actor = $this->podcast->actor;
if (
($note = (new NoteModel())->getNoteById($params[1])) === null
count($params) > 1 &&
($note = (new NoteModel())->getNoteById($params[1])) !== null
) {
throw PageNotFoundException::forPageNotFound();
$this->note = $note;
unset($params[0]);
unset($params[1]);
}
$this->note = $note;
unset($params[0]);
unset($params[1]);
return $this->{$method}(...$params);
}