mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-31 18:01:00 +01:00
Add ApplicationTransactions to Herald
Summary: Ref T2769. I'm planning to keep this pretty simple, but we have this ad-hoc edit log for rules already and some other mess that we can clean up. Test Plan: No effect yet; see future changes. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2769 Differential Revision: https://secure.phabricator.com/D6654
This commit is contained in:
parent
589ae8d26d
commit
b1c4a258c9
5 changed files with 84 additions and 0 deletions
40
resources/sql/patches/20130802.heraldxactions.sql
Normal file
40
resources/sql/patches/20130802.heraldxactions.sql
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_herald.herald_ruletransaction (
|
||||||
|
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
phid VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
objectPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
editPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
commentPHID VARCHAR(64) COLLATE utf8_bin,
|
||||||
|
commentVersion INT UNSIGNED NOT NULL,
|
||||||
|
transactionType VARCHAR(32) NOT NULL COLLATE utf8_bin,
|
||||||
|
oldValue LONGTEXT NOT NULL COLLATE utf8_bin,
|
||||||
|
newValue LONGTEXT NOT NULL COLLATE utf8_bin,
|
||||||
|
contentSource LONGTEXT NOT NULL COLLATE utf8_bin,
|
||||||
|
metadata LONGTEXT NOT NULL COLLATE utf8_bin,
|
||||||
|
dateCreated INT UNSIGNED NOT NULL,
|
||||||
|
dateModified INT UNSIGNED NOT NULL,
|
||||||
|
|
||||||
|
UNIQUE KEY `key_phid` (phid),
|
||||||
|
KEY `key_object` (objectPHID)
|
||||||
|
|
||||||
|
) ENGINE=InnoDB, COLLATE utf8_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE {$NAMESPACE}_herald.herald_ruletransaction_comment (
|
||||||
|
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
phid VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
transactionPHID VARCHAR(64) COLLATE utf8_bin,
|
||||||
|
authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
editPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
|
||||||
|
commentVersion INT UNSIGNED NOT NULL,
|
||||||
|
content LONGTEXT NOT NULL COLLATE utf8_bin,
|
||||||
|
contentSource LONGTEXT NOT NULL COLLATE utf8_bin,
|
||||||
|
isDeleted BOOL NOT NULL,
|
||||||
|
dateCreated INT UNSIGNED NOT NULL,
|
||||||
|
dateModified INT UNSIGNED NOT NULL,
|
||||||
|
|
||||||
|
UNIQUE KEY `key_phid` (phid),
|
||||||
|
UNIQUE KEY `key_version` (transactionPHID, commentVersion)
|
||||||
|
|
||||||
|
) ENGINE=InnoDB, COLLATE utf8_general_ci;
|
|
@ -627,6 +627,8 @@ phutil_register_library_map(array(
|
||||||
'HeraldRuleListController' => 'applications/herald/controller/HeraldRuleListController.php',
|
'HeraldRuleListController' => 'applications/herald/controller/HeraldRuleListController.php',
|
||||||
'HeraldRuleQuery' => 'applications/herald/query/HeraldRuleQuery.php',
|
'HeraldRuleQuery' => 'applications/herald/query/HeraldRuleQuery.php',
|
||||||
'HeraldRuleSearchEngine' => 'applications/herald/query/HeraldRuleSearchEngine.php',
|
'HeraldRuleSearchEngine' => 'applications/herald/query/HeraldRuleSearchEngine.php',
|
||||||
|
'HeraldRuleTransaction' => 'applications/herald/storage/HeraldRuleTransaction.php',
|
||||||
|
'HeraldRuleTransactionComment' => 'applications/herald/storage/HeraldRuleTransactionComment.php',
|
||||||
'HeraldRuleTranscript' => 'applications/herald/storage/transcript/HeraldRuleTranscript.php',
|
'HeraldRuleTranscript' => 'applications/herald/storage/transcript/HeraldRuleTranscript.php',
|
||||||
'HeraldRuleTypeConfig' => 'applications/herald/config/HeraldRuleTypeConfig.php',
|
'HeraldRuleTypeConfig' => 'applications/herald/config/HeraldRuleTypeConfig.php',
|
||||||
'HeraldTestConsoleController' => 'applications/herald/controller/HeraldTestConsoleController.php',
|
'HeraldTestConsoleController' => 'applications/herald/controller/HeraldTestConsoleController.php',
|
||||||
|
@ -2639,6 +2641,8 @@ phutil_register_library_map(array(
|
||||||
),
|
),
|
||||||
'HeraldRuleQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'HeraldRuleQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'HeraldRuleSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'HeraldRuleSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
|
'HeraldRuleTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
|
'HeraldRuleTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||||
'HeraldTestConsoleController' => 'HeraldController',
|
'HeraldTestConsoleController' => 'HeraldController',
|
||||||
'HeraldTranscript' => 'HeraldDAO',
|
'HeraldTranscript' => 'HeraldDAO',
|
||||||
'HeraldTranscriptController' => 'HeraldController',
|
'HeraldTranscriptController' => 'HeraldController',
|
||||||
|
|
25
src/applications/herald/storage/HeraldRuleTransaction.php
Normal file
25
src/applications/herald/storage/HeraldRuleTransaction.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class HeraldRuleTransaction
|
||||||
|
extends PhabricatorApplicationTransaction {
|
||||||
|
|
||||||
|
const TYPE_EDIT = 'herald:edit';
|
||||||
|
|
||||||
|
public function getApplicationName() {
|
||||||
|
return 'herald';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getApplicationTransactionType() {
|
||||||
|
return HeraldPHIDTypeRule::TYPECONST;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getApplicationTransactionCommentObject() {
|
||||||
|
return new HeraldRuleTransactionComment();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getApplicationObjectTypeName() {
|
||||||
|
return pht('rule');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class HeraldRuleTransactionComment
|
||||||
|
extends PhabricatorApplicationTransactionComment {
|
||||||
|
|
||||||
|
public function getApplicationTransactionObject() {
|
||||||
|
return new HeraldRuleTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1531,6 +1531,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
|
||||||
'type' => 'sql',
|
'type' => 'sql',
|
||||||
'name' => $this->getPatchPath('20130802.heraldphidukey.sql'),
|
'name' => $this->getPatchPath('20130802.heraldphidukey.sql'),
|
||||||
),
|
),
|
||||||
|
'20130802.heraldxactions.sql' => array(
|
||||||
|
'type' => 'sql',
|
||||||
|
'name' => $this->getPatchPath('20130802.heraldxactions.sql'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue