mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-24 07:42:40 +01:00
27 lines
548 B
PHP
27 lines
548 B
PHP
|
<?php
|
||
|
|
||
|
abstract class PhabricatorRequestExceptionHandler
|
||
|
extends AphrontRequestExceptionHandler {
|
||
|
|
||
|
protected function isPhabricatorSite(AphrontRequest $request) {
|
||
|
$site = $request->getSite();
|
||
|
if (!$site) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return ($site instanceof PhabricatorSite);
|
||
|
}
|
||
|
|
||
|
protected function getViewer(AphrontRequest $request) {
|
||
|
$viewer = $request->getUser();
|
||
|
|
||
|
if ($viewer) {
|
||
|
return $viewer;
|
||
|
}
|
||
|
|
||
|
// If we hit an exception very early, we won't have a user yet.
|
||
|
return new PhabricatorUser();
|
||
|
}
|
||
|
|
||
|
}
|