Changeset View
Changeset View
Standalone View
Standalone View
src/applications/draft/storage/PhabricatorDraft.php
<?php | <?php | ||||
final class PhabricatorDraft extends PhabricatorDraftDAO { | final class PhabricatorDraft extends PhabricatorDraftDAO { | ||||
protected $authorPHID; | protected $authorPHID; | ||||
protected $draftKey; | protected $draftKey; | ||||
protected $draft; | protected $draft; | ||||
protected $metadata = array(); | protected $metadata = array(); | ||||
private $deleted = false; | private $deleted = false; | ||||
public function getConfiguration() { | public function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_SERIALIZATION => array( | self::CONFIG_SERIALIZATION => array( | ||||
'metadata' => self::SERIALIZATION_JSON, | 'metadata' => self::SERIALIZATION_JSON, | ||||
), | ), | ||||
self::CONFIG_COLUMN_SCHEMA => array( | |||||
'draftKey' => 'text64', | |||||
'draft' => 'text', | |||||
), | |||||
self::CONFIG_KEY_SCHEMA => array( | |||||
'authorPHID' => array( | |||||
'columns' => array('authorPHID', 'draftKey'), | |||||
), | |||||
), | |||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function replaceOrDelete() { | public function replaceOrDelete() { | ||||
if ($this->draft == '' && !array_filter($this->metadata)) { | if ($this->draft == '' && !array_filter($this->metadata)) { | ||||
queryfx( | queryfx( | ||||
$this->establishConnection('w'), | $this->establishConnection('w'), | ||||
'DELETE FROM %T WHERE authorPHID = %s AND draftKey = %s', | 'DELETE FROM %T WHERE authorPHID = %s AND draftKey = %s', | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |