MetaMTA - lay some ground work for having an application

Summary:
Ref T5791. This does a few bits there. Namely:

 - Adds PHID column to PhabricatorMetaMTAMail
   - Implements a PhabricatorMetaMTAMailPHIDType
   - Script to backpopulate them.
 - Makes PhabricatorMetaMTAMail implement PolicyInterface.
   - View policy is NOONE and the author and recipients have automatic view capabilities
   - No edit capability.
 - Adds a PhabricatorMetaMTAMailQuery for PhabricatorMetaMTAMail.

Test Plan: ran `./bin/storage upgrade` successfully. commented on a maniphest task and verifed the metamta mail object in the database was created successfully with a shiny new phid

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5791

Differential Revision: https://secure.phabricator.com/D13394
This commit is contained in:
Bob Trahan
2015-06-22 13:46:26 -07:00
parent c3efa261f9
commit ea5462fb60
7 changed files with 168 additions and 2 deletions

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_metamta.metamta_mail
ADD phid VARBINARY(64) NOT NULL AFTER id;

View File

@@ -0,0 +1,22 @@
<?php
$table = new PhabricatorMetaMTAMail();
$conn_w = $table->establishConnection('w');
echo pht('Assigning PHIDs to mails...')."\n";
foreach (new LiskMigrationIterator($table) as $mail) {
$id = $mail->getID();
echo pht('Updating mail %d...', $id)."\n";
if ($mail->getPHID()) {
continue;
}
queryfx(
$conn_w,
'UPDATE %T SET phid = %s WHERE id = %d',
$table->getTableName(),
$table->generatePHID(),
$id);
}
echo pht('Done.')."\n";

View File

@@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_metamta.metamta_mail
ADD UNIQUE KEY `key_phid` (phid);