Page MenuHomePhabricator

D17738.diff
No OneTemporary

D17738.diff

diff --git a/resources/sql/autopatches/20170419.app.01.table.sql b/resources/sql/autopatches/20170419.app.01.table.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170419.app.01.table.sql
@@ -0,0 +1,7 @@
+CREATE TABLE {$NAMESPACE}_application.application_application (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ phid VARBINARY(64) NOT NULL,
+ dateCreated INT UNSIGNED NOT NULL,
+ dateModified INT UNSIGNED NOT NULL,
+ UNIQUE KEY `key_phid` (phid)
+) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
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
@@ -1838,6 +1838,8 @@
'PhabricatorAppSearchEngine' => 'applications/meta/query/PhabricatorAppSearchEngine.php',
'PhabricatorApplication' => 'applications/base/PhabricatorApplication.php',
'PhabricatorApplicationApplicationPHIDType' => 'applications/meta/phid/PhabricatorApplicationApplicationPHIDType.php',
+ 'PhabricatorApplicationApplicationTransaction' => 'applications/meta/storage/PhabricatorApplicationApplicationTransaction.php',
+ 'PhabricatorApplicationApplicationTransactionQuery' => 'applications/meta/query/PhabricatorApplicationApplicationTransactionQuery.php',
'PhabricatorApplicationConfigOptions' => 'applications/config/option/PhabricatorApplicationConfigOptions.php',
'PhabricatorApplicationConfigurationPanel' => 'applications/meta/panel/PhabricatorApplicationConfigurationPanel.php',
'PhabricatorApplicationConfigurationPanelTestCase' => 'applications/meta/panel/__tests__/PhabricatorApplicationConfigurationPanelTestCase.php',
@@ -1849,6 +1851,7 @@
'PhabricatorApplicationPanelController' => 'applications/meta/controller/PhabricatorApplicationPanelController.php',
'PhabricatorApplicationProfileMenuItem' => 'applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php',
'PhabricatorApplicationQuery' => 'applications/meta/query/PhabricatorApplicationQuery.php',
+ 'PhabricatorApplicationSchemaSpec' => 'applications/meta/storage/PhabricatorApplicationSchemaSpec.php',
'PhabricatorApplicationSearchController' => 'applications/search/controller/PhabricatorApplicationSearchController.php',
'PhabricatorApplicationSearchEngine' => 'applications/search/engine/PhabricatorApplicationSearchEngine.php',
'PhabricatorApplicationSearchEngineTestCase' => 'applications/search/engine/__tests__/PhabricatorApplicationSearchEngineTestCase.php',
@@ -1881,6 +1884,7 @@
'PhabricatorApplicationTransactionTemplatedCommentQuery' => 'applications/transactions/query/PhabricatorApplicationTransactionTemplatedCommentQuery.php',
'PhabricatorApplicationTransactionTextDiffDetailView' => 'applications/transactions/view/PhabricatorApplicationTransactionTextDiffDetailView.php',
'PhabricatorApplicationTransactionTransactionPHIDType' => 'applications/transactions/phid/PhabricatorApplicationTransactionTransactionPHIDType.php',
+ 'PhabricatorApplicationTransactionType' => 'applications/meta/xactions/PhabricatorApplicationTransactionType.php',
'PhabricatorApplicationTransactionValidationError' => 'applications/transactions/error/PhabricatorApplicationTransactionValidationError.php',
'PhabricatorApplicationTransactionValidationException' => 'applications/transactions/exception/PhabricatorApplicationTransactionValidationException.php',
'PhabricatorApplicationTransactionValidationResponse' => 'applications/transactions/response/PhabricatorApplicationTransactionValidationResponse.php',
@@ -6847,10 +6851,13 @@
'PhabricatorAphrontViewTestCase' => 'PhabricatorTestCase',
'PhabricatorAppSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorApplication' => array(
- 'Phobject',
+ 'PhabricatorLiskDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorApplicationTransactionInterface',
),
'PhabricatorApplicationApplicationPHIDType' => 'PhabricatorPHIDType',
+ 'PhabricatorApplicationApplicationTransaction' => 'PhabricatorModularTransaction',
+ 'PhabricatorApplicationApplicationTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorApplicationConfigOptions' => 'Phobject',
'PhabricatorApplicationConfigurationPanel' => 'Phobject',
'PhabricatorApplicationConfigurationPanelTestCase' => 'PhabricatorTestCase',
@@ -6862,6 +6869,7 @@
'PhabricatorApplicationPanelController' => 'PhabricatorApplicationsController',
'PhabricatorApplicationProfileMenuItem' => 'PhabricatorProfileMenuItem',
'PhabricatorApplicationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'PhabricatorApplicationSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorApplicationSearchController' => 'PhabricatorSearchBaseController',
'PhabricatorApplicationSearchEngine' => 'Phobject',
'PhabricatorApplicationSearchEngineTestCase' => 'PhabricatorTestCase',
@@ -6902,6 +6910,7 @@
'PhabricatorApplicationTransactionTemplatedCommentQuery' => 'PhabricatorApplicationTransactionCommentQuery',
'PhabricatorApplicationTransactionTextDiffDetailView' => 'AphrontView',
'PhabricatorApplicationTransactionTransactionPHIDType' => 'PhabricatorPHIDType',
+ 'PhabricatorApplicationTransactionType' => 'PhabricatorModularTransactionType',
'PhabricatorApplicationTransactionValidationError' => 'Phobject',
'PhabricatorApplicationTransactionValidationException' => 'Exception',
'PhabricatorApplicationTransactionValidationResponse' => 'AphrontProxyResponse',
diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php
--- a/src/applications/base/PhabricatorApplication.php
+++ b/src/applications/base/PhabricatorApplication.php
@@ -9,7 +9,7 @@
* @task meta Application Management
*/
abstract class PhabricatorApplication
- extends Phobject
+ extends PhabricatorLiskDAO
implements
PhabricatorPolicyInterface,
PhabricatorApplicationTransactionInterface {
@@ -28,6 +28,30 @@
);
}
+ final public function getApplicationName() {
+ return 'application';
+ }
+
+ final public function getTableName() {
+ return 'application_application';
+ }
+
+ final protected function getConfiguration() {
+ return array(
+ self::CONFIG_AUX_PHID => true,
+ ) + parent::getConfiguration();
+ }
+
+ final public function generatePHID() {
+ return $this->getPHID();
+ }
+
+ final public function save() {
+ // When "save()" is called on applications, we just return without
+ // actually writing anything to the database.
+ return $this;
+ }
+
/* -( Application Information )-------------------------------------------- */
diff --git a/src/applications/config/schema/PhabricatorConfigDatabaseSchema.php b/src/applications/config/schema/PhabricatorConfigDatabaseSchema.php
--- a/src/applications/config/schema/PhabricatorConfigDatabaseSchema.php
+++ b/src/applications/config/schema/PhabricatorConfigDatabaseSchema.php
@@ -11,6 +11,13 @@
public function addTable(PhabricatorConfigTableSchema $table) {
$key = $table->getName();
if (isset($this->tables[$key])) {
+
+ if ($key == 'application_application') {
+ // NOTE: This is a terrible hack to allow Application subclasses to
+ // extend LiskDAO so we can apply transactions to them.
+ return $this;
+ }
+
throw new Exception(
pht('Trying to add duplicate table "%s"!', $key));
}
diff --git a/src/applications/meta/xactions/PhabricatorApplicationApplicationTransaction.php b/src/applications/meta/storage/PhabricatorApplicationApplicationTransaction.php
rename from src/applications/meta/xactions/PhabricatorApplicationApplicationTransaction.php
rename to src/applications/meta/storage/PhabricatorApplicationApplicationTransaction.php
diff --git a/src/applications/meta/storage/PhabricatorApplicationApplicationTransactionComment.php b/src/applications/meta/storage/PhabricatorApplicationApplicationTransactionComment.php
deleted file mode 100644
--- a/src/applications/meta/storage/PhabricatorApplicationApplicationTransactionComment.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-final class PhabricatorApplicationApplicationTransactionComment
- extends PhabricatorApplicationTransactionComment {
-
- public function getApplicationTransactionObject() {
- return new PhabricatorApplicationApplicationTransaction();
- }
-
-}
diff --git a/src/applications/meta/storage/PhabricatorApplicationSchemaSpec.php b/src/applications/meta/storage/PhabricatorApplicationSchemaSpec.php
new file mode 100644
--- /dev/null
+++ b/src/applications/meta/storage/PhabricatorApplicationSchemaSpec.php
@@ -0,0 +1,10 @@
+<?php
+
+final class PhabricatorApplicationSchemaSpec
+ extends PhabricatorConfigSchemaSpec {
+
+ public function buildSchemata() {
+ $this->buildEdgeSchemata(new PhabricatorApplicationsApplication());
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 10, 1:27 PM (1 w, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6746950
Default Alt Text
D17738.diff (8 KB)

Event Timeline