Page MenuHomePhabricator

D10017.id24075.diff
No OneTemporary

D10017.id24075.diff

diff --git a/resources/sql/autopatches/20140722.audit.1.xactions.sql b/resources/sql/autopatches/20140722.audit.1.xactions.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140722.audit.1.xactions.sql
@@ -0,0 +1,19 @@
+CREATE TABLE {$NAMESPACE}_audit.audit_transaction (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ phid VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ authorPHID VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ objectPHID VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ viewPolicy VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ editPolicy VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ commentPHID VARCHAR(64) COLLATE utf8_bin DEFAULT NULL,
+ commentVersion INT UNSIGNED NOT NULL,
+ transactionType VARCHAR(32) COLLATE utf8_bin NOT NULL,
+ oldValue LONGTEXT COLLATE utf8_bin NOT NULL,
+ newValue LONGTEXT COLLATE utf8_bin NOT NULL,
+ contentSource LONGTEXT COLLATE utf8_bin NOT NULL,
+ metadata LONGTEXT COLLATE utf8_bin NOT NULL,
+ 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;
diff --git a/resources/sql/autopatches/20140722.audit.2.comments.sql b/resources/sql/autopatches/20140722.audit.2.comments.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140722.audit.2.comments.sql
@@ -0,0 +1,29 @@
+CREATE TABLE {$NAMESPACE}_audit.audit_transaction_comment (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ phid VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ transactionPHID VARCHAR(64) COLLATE utf8_bin,
+ authorPHID VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ viewPolicy VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ editPolicy VARCHAR(64) COLLATE utf8_bin NOT NULL,
+ commentVersion INT UNSIGNED NOT NULL,
+ content longtext COLLATE utf8_bin NOT NULL,
+ contentSource longtext COLLATE utf8_bin NOT NULL,
+ isDeleted BOOL NOT NULL,
+ dateCreated INT UNSIGNED NOT NULL,
+ dateModified INT UNSIGNED NOT NULL,
+ commitPHID VARCHAR(64) COLLATE utf8_bin,
+ pathID INT UNSIGNED,
+ isNewFile BOOL NOT NULL,
+ lineNumber INT UNSIGNED NOT NULL,
+ lineLength INT UNSIGNED NOT NULL,
+ fixedState VARCHAR(12) COLLATE utf8_bin,
+ hasReplies BOOL NOT NULL,
+ replyToCommentPHID VARCHAR(64) COLLATE utf8_bin,
+ legacyCommentID INT UNSIGNED,
+ UNIQUE KEY `key_phid` (phid),
+ UNIQUE KEY `key_version` (transactionPHID, commentVersion),
+ KEY `key_path` (pathID),
+ KEY `key_draft` (authorPHID, transactionPHID),
+ KEY `key_commit` (commitPHID),
+ KEY `key_legacy` (legacyCommentID)
+) ENGINE=InnoDB, COLLATE utf8_general_ci;
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1259,6 +1259,8 @@
'PhabricatorAuditPreviewController' => 'applications/audit/controller/PhabricatorAuditPreviewController.php',
'PhabricatorAuditReplyHandler' => 'applications/audit/mail/PhabricatorAuditReplyHandler.php',
'PhabricatorAuditStatusConstants' => 'applications/audit/constants/PhabricatorAuditStatusConstants.php',
+ 'PhabricatorAuditTransaction' => 'applications/audit/storage/PhabricatorAuditTransaction.php',
+ 'PhabricatorAuditTransactionComment' => 'applications/audit/storage/PhabricatorAuditTransactionComment.php',
'PhabricatorAuthAccountView' => 'applications/auth/view/PhabricatorAuthAccountView.php',
'PhabricatorAuthConfirmLinkController' => 'applications/auth/controller/PhabricatorAuthConfirmLinkController.php',
'PhabricatorAuthController' => 'applications/auth/controller/PhabricatorAuthController.php',
@@ -4046,6 +4048,8 @@
'PhabricatorAuditManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorAuditPreviewController' => 'PhabricatorAuditController',
'PhabricatorAuditReplyHandler' => 'PhabricatorMailReplyHandler',
+ 'PhabricatorAuditTransaction' => 'PhabricatorApplicationTransaction',
+ 'PhabricatorAuditTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PhabricatorAuthAccountView' => 'AphrontView',
'PhabricatorAuthConfirmLinkController' => 'PhabricatorAuthController',
'PhabricatorAuthController' => 'PhabricatorController',
diff --git a/src/applications/audit/storage/PhabricatorAuditTransaction.php b/src/applications/audit/storage/PhabricatorAuditTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/audit/storage/PhabricatorAuditTransaction.php
@@ -0,0 +1,20 @@
+<?php
+
+final class PhabricatorAuditTransaction
+ extends PhabricatorApplicationTransaction {
+
+ public function getApplicationName() {
+ return 'audit';
+ }
+
+ public function getApplicationTransactionType() {
+ // TODO: This might need to be fixed by the time this lands, since the
+ // class is being renamed.
+ return PhabricatorRepositoryPHIDTypeCommit::TYPECONST;
+ }
+
+ public function getApplicationTransactionCommentObject() {
+ return new PhabricatorAuditTransactionComment();
+ }
+
+}
diff --git a/src/applications/audit/storage/PhabricatorAuditTransactionComment.php b/src/applications/audit/storage/PhabricatorAuditTransactionComment.php
new file mode 100644
--- /dev/null
+++ b/src/applications/audit/storage/PhabricatorAuditTransactionComment.php
@@ -0,0 +1,25 @@
+<?php
+
+final class PhabricatorAuditTransactionComment
+ extends PhabricatorApplicationTransactionComment {
+
+ protected $commitPHID;
+ protected $pathID;
+ protected $isNewFile = 0;
+ protected $lineNumber = 0;
+ protected $lineLength = 0;
+ protected $fixedState;
+ protected $hasReplies = 0;
+ protected $replyToCommentPHID;
+ protected $legacyCommentID;
+
+ public function getApplicationTransactionObject() {
+ return new PhabricatorAuditTransaction();
+ }
+
+ public function shouldUseMarkupCache($field) {
+ // Only cache submitted comments.
+ return ($this->getTransactionPHID() != null);
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 4, 1:46 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7725694
Default Alt Text
D10017.id24075.diff (5 KB)

Event Timeline