mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Remove on-object mailkeys from Phriction
Summary: Depends on D19619. Ref T13065. Ref T13077. Migrate Phriction mail keys to the new infrastructure and drop the column. Test Plan: Ran migrations, spot-checked the database. Reviewers: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13077, T13065 Differential Revision: https://secure.phabricator.com/D19620
This commit is contained in:
parent
64cee4a902
commit
50f4adef64
3 changed files with 31 additions and 12 deletions
26
resources/sql/autopatches/20180829.phriction.01.mailkey.php
Normal file
26
resources/sql/autopatches/20180829.phriction.01.mailkey.php
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$document_table = new PhrictionDocument();
|
||||||
|
$document_conn = $document_table->establishConnection('w');
|
||||||
|
$document_name = $document_table->getTableName();
|
||||||
|
|
||||||
|
$properties_table = new PhabricatorMetaMTAMailProperties();
|
||||||
|
$conn = $properties_table->establishConnection('w');
|
||||||
|
|
||||||
|
$iterator = new LiskRawMigrationIterator($document_conn, $document_name);
|
||||||
|
foreach ($iterator as $row) {
|
||||||
|
queryfx(
|
||||||
|
$conn,
|
||||||
|
'INSERT IGNORE INTO %T
|
||||||
|
(objectPHID, mailProperties, dateCreated, dateModified)
|
||||||
|
VALUES
|
||||||
|
(%s, %s, %d, %d)',
|
||||||
|
$properties_table->getTableName(),
|
||||||
|
$row['phid'],
|
||||||
|
phutil_json_encode(
|
||||||
|
array(
|
||||||
|
'mailKey' => $row['mailKey'],
|
||||||
|
)),
|
||||||
|
PhabricatorTime::getNow(),
|
||||||
|
PhabricatorTime::getNow());
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_phriction.phriction_document
|
||||||
|
DROP mailKey;
|
|
@ -19,7 +19,6 @@ final class PhrictionDocument extends PhrictionDAO
|
||||||
protected $depth;
|
protected $depth;
|
||||||
protected $contentPHID;
|
protected $contentPHID;
|
||||||
protected $status;
|
protected $status;
|
||||||
protected $mailKey;
|
|
||||||
protected $viewPolicy;
|
protected $viewPolicy;
|
||||||
protected $editPolicy;
|
protected $editPolicy;
|
||||||
protected $spacePHID;
|
protected $spacePHID;
|
||||||
|
@ -36,7 +35,6 @@ final class PhrictionDocument extends PhrictionDAO
|
||||||
'slug' => 'sort128',
|
'slug' => 'sort128',
|
||||||
'depth' => 'uint32',
|
'depth' => 'uint32',
|
||||||
'status' => 'text32',
|
'status' => 'text32',
|
||||||
'mailKey' => 'bytes20',
|
|
||||||
'editedEpoch' => 'epoch',
|
'editedEpoch' => 'epoch',
|
||||||
),
|
),
|
||||||
self::CONFIG_KEY_SCHEMA => array(
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
@ -95,13 +93,6 @@ final class PhrictionDocument extends PhrictionDAO
|
||||||
return $document;
|
return $document;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save() {
|
|
||||||
if (!$this->getMailKey()) {
|
|
||||||
$this->setMailKey(Filesystem::readRandomCharacters(20));
|
|
||||||
}
|
|
||||||
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/',
|
||||||
|
@ -329,9 +320,9 @@ final class PhrictionDocument extends PhrictionDAO
|
||||||
/* -( PhabricatorPolicyCodexInterface )------------------------------------ */
|
/* -( PhabricatorPolicyCodexInterface )------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
public function newPolicyCodex() {
|
public function newPolicyCodex() {
|
||||||
return new PhrictionDocumentPolicyCodex();
|
return new PhrictionDocumentPolicyCodex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue