mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-17 20:32:41 +01:00
Make Applications extend LiskDAO
Summary: Ref T11476. This is a bit hacky, but makes `Application` extend `LiskDAO` so we can apply transactions to it with an `Editor` class. Also fixes schema stuff so builds should produce a clean bill of health again. This might only get you slightly further, yell if you run into more trouble. Test Plan: - Ran `bin/storage upgrade -f` and got no warnings. - Browsed around, nothing exploded? Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T11476 Differential Revision: https://secure.phabricator.com/D17738
This commit is contained in:
parent
d58b808f04
commit
95dd9dbf43
7 changed files with 59 additions and 12 deletions
7
resources/sql/autopatches/20170419.app.01.table.sql
Normal file
7
resources/sql/autopatches/20170419.app.01.table.sql
Normal file
|
@ -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};
|
|
@ -1838,6 +1838,8 @@ phutil_register_library_map(array(
|
|||
'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 @@ phutil_register_library_map(array(
|
|||
'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 @@ phutil_register_library_map(array(
|
|||
'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 @@ phutil_register_library_map(array(
|
|||
'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 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationPanelController' => 'PhabricatorApplicationsController',
|
||||
'PhabricatorApplicationProfileMenuItem' => 'PhabricatorProfileMenuItem',
|
||||
'PhabricatorApplicationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhabricatorApplicationSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'PhabricatorApplicationSearchController' => 'PhabricatorSearchBaseController',
|
||||
'PhabricatorApplicationSearchEngine' => 'Phobject',
|
||||
'PhabricatorApplicationSearchEngineTestCase' => 'PhabricatorTestCase',
|
||||
|
@ -6902,6 +6910,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationTransactionTemplatedCommentQuery' => 'PhabricatorApplicationTransactionCommentQuery',
|
||||
'PhabricatorApplicationTransactionTextDiffDetailView' => 'AphrontView',
|
||||
'PhabricatorApplicationTransactionTransactionPHIDType' => 'PhabricatorPHIDType',
|
||||
'PhabricatorApplicationTransactionType' => 'PhabricatorModularTransactionType',
|
||||
'PhabricatorApplicationTransactionValidationError' => 'Phobject',
|
||||
'PhabricatorApplicationTransactionValidationException' => 'Exception',
|
||||
'PhabricatorApplicationTransactionValidationResponse' => 'AphrontProxyResponse',
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @task meta Application Management
|
||||
*/
|
||||
abstract class PhabricatorApplication
|
||||
extends Phobject
|
||||
extends PhabricatorLiskDAO
|
||||
implements
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorApplicationTransactionInterface {
|
||||
|
@ -28,6 +28,30 @@ abstract class PhabricatorApplication
|
|||
);
|
||||
}
|
||||
|
||||
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 )-------------------------------------------- */
|
||||
|
||||
|
|
|
@ -11,6 +11,13 @@ final class PhabricatorConfigDatabaseSchema
|
|||
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));
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorApplicationApplicationTransactionComment
|
||||
extends PhabricatorApplicationTransactionComment {
|
||||
|
||||
public function getApplicationTransactionObject() {
|
||||
return new PhabricatorApplicationApplicationTransaction();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorApplicationSchemaSpec
|
||||
extends PhabricatorConfigSchemaSpec {
|
||||
|
||||
public function buildSchemata() {
|
||||
$this->buildEdgeSchemata(new PhabricatorApplicationsApplication());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue