Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phriction/storage/PhrictionDocument.php
<?php | <?php | ||||
final class PhrictionDocument extends PhrictionDAO | final class PhrictionDocument extends PhrictionDAO | ||||
implements | implements | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
PhabricatorSubscribableInterface, | PhabricatorSubscribableInterface, | ||||
PhabricatorFlaggableInterface, | PhabricatorFlaggableInterface, | ||||
PhabricatorTokenReceiverInterface, | PhabricatorTokenReceiverInterface, | ||||
PhabricatorDestructibleInterface, | PhabricatorDestructibleInterface, | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorFulltextInterface, | ||||
PhabricatorFulltextInterface { | PhabricatorProjectInterface, | ||||
PhabricatorApplicationTransactionInterface { | |||||
protected $slug; | protected $slug; | ||||
protected $depth; | protected $depth; | ||||
protected $contentID; | protected $contentID; | ||||
protected $status; | protected $status; | ||||
protected $mailKey; | protected $mailKey; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | final class PhrictionDocument extends PhrictionDAO | ||||
public function save() { | public function save() { | ||||
if (!$this->getMailKey()) { | if (!$this->getMailKey()) { | ||||
$this->setMailKey(Filesystem::readRandomCharacters(20)); | $this->setMailKey(Filesystem::readRandomCharacters(20)); | ||||
} | } | ||||
return parent::save(); | return parent::save(); | ||||
} | } | ||||
public static function getSlugURI($slug, $type = 'document') { | public static function getSlugURI($slug, $type = 'document') { | ||||
static $types = array( | static $types = array( | ||||
'document' => '/w/', | 'document' => '/w/', | ||||
'history' => '/phriction/history/', | 'history' => '/phriction/history/', | ||||
); | ); | ||||
if (empty($types[$type])) { | if (empty($types[$type])) { | ||||
throw new Exception(pht("Unknown URI type '%s'!", $type)); | throw new Exception(pht("Unknown URI type '%s'!", $type)); | ||||
epriestley: I think we should probably trend away from having `attachProjectPHID()` methods, since… | |||||
} | } | ||||
$prefix = $types[$type]; | $prefix = $types[$type]; | ||||
if ($slug == '/') { | if ($slug == '/') { | ||||
return $prefix; | return $prefix; | ||||
} else { | } else { | ||||
// NOTE: The effect here is to escape non-latin characters, since modern | // NOTE: The effect here is to escape non-latin characters, since modern | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |
I think we should probably trend away from having attachProjectPHID() methods, since EditEngine and other infrastructure do it for you in modern code and this would have no callers if everything was fully modernized. In legacy code, fine to just EdgeQuery directly when you need this data so everything gets deleted when the code is modernized. Definitely not a big deal, though -- code is fine, just risks not getting cleaned up when we modernize fully.
Actually, it looks like none of this has callers even in this diff, since the EditController changes do just use EdgeQuery directly? Just nuke these changes?