Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15447243
D10017.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D10017.id.diff
View Options
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
@@ -1148,6 +1148,9 @@
'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',
+ 'PhabricatorAuditTransactionQuery' => 'applications/audit/query/PhabricatorAuditTransactionQuery.php',
'PhabricatorAuthAccountView' => 'applications/auth/view/PhabricatorAuthAccountView.php',
'PhabricatorAuthApplication' => 'applications/auth/application/PhabricatorAuthApplication.php',
'PhabricatorAuthAuthFactorPHIDType' => 'applications/auth/phid/PhabricatorAuthAuthFactorPHIDType.php',
@@ -3940,6 +3943,9 @@
'PhabricatorAuditManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorAuditPreviewController' => 'PhabricatorAuditController',
'PhabricatorAuditReplyHandler' => 'PhabricatorMailReplyHandler',
+ 'PhabricatorAuditTransaction' => 'PhabricatorApplicationTransaction',
+ 'PhabricatorAuditTransactionComment' => 'PhabricatorApplicationTransactionComment',
+ 'PhabricatorAuditTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorAuthAccountView' => 'AphrontView',
'PhabricatorAuthApplication' => 'PhabricatorApplication',
'PhabricatorAuthAuthFactorPHIDType' => 'PhabricatorPHIDType',
diff --git a/src/applications/audit/query/PhabricatorAuditTransactionQuery.php b/src/applications/audit/query/PhabricatorAuditTransactionQuery.php
new file mode 100644
--- /dev/null
+++ b/src/applications/audit/query/PhabricatorAuditTransactionQuery.php
@@ -0,0 +1,10 @@
+<?php
+
+final class PhabricatorAuditTransactionQuery
+ extends PhabricatorApplicationTransactionQuery {
+
+ public function getTemplateApplicationTransaction() {
+ return new PhabricatorAuditTransaction();
+ }
+
+}
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,18 @@
+<?php
+
+final class PhabricatorAuditTransaction
+ extends PhabricatorApplicationTransaction {
+
+ public function getApplicationName() {
+ return 'audit';
+ }
+
+ public function getApplicationTransactionType() {
+ return PhabricatorRepositoryCommitPHIDType::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
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 28, 10:42 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7639978
Default Alt Text
D10017.id.diff (6 KB)
Attached To
Mode
D10017: Add storage for new audit transactions and comments
Attached
Detach File
Event Timeline
Log In to Comment