Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/mail/FileMailReceiver.php
<?php | <?php | ||||
final class FileMailReceiver extends PhabricatorObjectMailReceiver { | final class FileMailReceiver extends PhabricatorObjectMailReceiver { | ||||
public function isEnabled() { | public function isEnabled() { | ||||
return PhabricatorApplication::isClassInstalled( | return PhabricatorApplication::isClassInstalled( | ||||
'PhabricatorFilesApplication'); | 'PhabricatorFilesApplication'); | ||||
} | } | ||||
protected function getObjectPattern() { | protected function getObjectPattern() { | ||||
return 'F[1-9]\d*'; | return 'F[1-9]\d*'; | ||||
} | } | ||||
protected function loadObject($pattern, PhabricatorUser $viewer) { | protected function loadObject($pattern, PhabricatorUser $viewer) { | ||||
$id = (int)trim($pattern, 'F'); | $id = (int)substr($pattern, 1); | ||||
return id(new PhabricatorFileQuery()) | return id(new PhabricatorFileQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withIDs(array($id)) | ->withIDs(array($id)) | ||||
->executeOne(); | ->executeOne(); | ||||
} | } | ||||
protected function getTransactionReplyHandler() { | protected function getTransactionReplyHandler() { | ||||
return new FileReplyHandler(); | return new FileReplyHandler(); | ||||
} | } | ||||
} | } |