Page MenuHomePhabricator

D19922.id47547.diff
No OneTemporary

D19922.id47547.diff

diff --git a/resources/sql/autopatches/20181220.pholio.01.mailkey.php b/resources/sql/autopatches/20181220.pholio.01.mailkey.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20181220.pholio.01.mailkey.php
@@ -0,0 +1,28 @@
+<?php
+
+$mock_table = new PholioMock();
+$mock_conn = $mock_table->establishConnection('w');
+
+$properties_table = new PhabricatorMetaMTAMailProperties();
+$conn = $properties_table->establishConnection('w');
+
+$iterator = new LiskRawMigrationIterator(
+ $mock_conn,
+ $mock_table->getTableName());
+
+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());
+}
diff --git a/resources/sql/autopatches/20181220.pholio.02.dropmailkey.sql b/resources/sql/autopatches/20181220.pholio.02.dropmailkey.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20181220.pholio.02.dropmailkey.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_pholio.pholio_mock
+ DROP mailKey;
diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php
--- a/src/applications/pholio/storage/PholioMock.php
+++ b/src/applications/pholio/storage/PholioMock.php
@@ -25,7 +25,6 @@
protected $name;
protected $description;
protected $coverPHID;
- protected $mailKey;
protected $status;
protected $spacePHID;
@@ -65,15 +64,9 @@
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text128',
'description' => 'text',
- 'mailKey' => 'bytes20',
'status' => 'text12',
),
self::CONFIG_KEY_SCHEMA => array(
- 'key_phid' => null,
- 'phid' => array(
- 'columns' => array('phid'),
- 'unique' => true,
- ),
'authorPHID' => array(
'columns' => array('authorPHID'),
),
@@ -81,15 +74,8 @@
) + parent::getConfiguration();
}
- public function generatePHID() {
- return PhabricatorPHID::generateNewPHID('MOCK');
- }
-
- public function save() {
- if (!$this->getMailKey()) {
- $this->setMailKey(Filesystem::readRandomCharacters(20));
- }
- return parent::save();
+ public function getPHIDType() {
+ return PholioMockPHIDType::TYPECONST;
}
public function attachImages(array $images) {

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 5, 1:24 PM (15 h, 48 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225066
Default Alt Text
D19922.id47547.diff (2 KB)

Event Timeline