mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Add basic auxiliary field storage for Differential
Summary: Precursor to building this out to solve T343. This is similar to the Maniphest fields we landed recently, although I think they're dissimilar enough that it isn't worth going crazy trying to make them share code, at least for now. This doesn't really do anything yet, just adds a storage object and a couple of selector/field indirection classes. Test Plan: Ran SQL upgrade script, created an aux field. Reviewed By: jungejason Reviewers: jungejason, tuomaspelkonen, aran CC: aran, jungejason Differential Revision: 798
This commit is contained in:
parent
7571d4c02a
commit
dd74903cae
11 changed files with 182 additions and 0 deletions
|
@ -446,6 +446,9 @@ return array(
|
|||
),
|
||||
|
||||
|
||||
'differential.field-selector' => 'DifferentialDefaultFieldSelector',
|
||||
|
||||
|
||||
// -- Maniphest ------------------------------------------------------------- //
|
||||
|
||||
'maniphest.enabled' => true,
|
||||
|
|
10
resources/sql/patches/070.differentialaux.sql
Normal file
10
resources/sql/patches/070.differentialaux.sql
Normal file
|
@ -0,0 +1,10 @@
|
|||
CREATE TABLE phabricator_differential.differential_auxiliaryfield (
|
||||
id INT UNSIGNED NOT NULL auto_increment PRIMARY KEY,
|
||||
revisionPHID varchar(64) BINARY NOT NULL,
|
||||
name VARCHAR(32) BINARY NOT NULL,
|
||||
value LONGBLOB NOT NULL,
|
||||
UNIQUE KEY (revisionPHID, name),
|
||||
KEY (name, value(64)),
|
||||
dateCreated INT UNSIGNED NOT NULL,
|
||||
dateModified INT UNSIGNED NOT NULL
|
||||
) ENGINE = InnoDB;
|
|
@ -133,6 +133,7 @@ phutil_register_library_map(array(
|
|||
'DatabaseConfigurationProvider' => 'applications/base/storage/configuration',
|
||||
'DifferentialAction' => 'applications/differential/constants/action',
|
||||
'DifferentialAddCommentView' => 'applications/differential/view/addcomment',
|
||||
'DifferentialAuxiliaryField' => 'applications/differential/storage/auxiliaryfield',
|
||||
'DifferentialCCWelcomeMail' => 'applications/differential/mail/ccwelcome',
|
||||
'DifferentialChangeType' => 'applications/differential/constants/changetype',
|
||||
'DifferentialChangeset' => 'applications/differential/storage/changeset',
|
||||
|
@ -152,6 +153,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialCommitMessageParserException' => 'applications/differential/parser/commitmessage/exception',
|
||||
'DifferentialController' => 'applications/differential/controller/base',
|
||||
'DifferentialDAO' => 'applications/differential/storage/base',
|
||||
'DifferentialDefaultFieldSelector' => 'applications/differential/field/selector/default',
|
||||
'DifferentialDiff' => 'applications/differential/storage/diff',
|
||||
'DifferentialDiffContentMail' => 'applications/differential/mail/diffcontent',
|
||||
'DifferentialDiffCreateController' => 'applications/differential/controller/diffcreate',
|
||||
|
@ -159,6 +161,8 @@ phutil_register_library_map(array(
|
|||
'DifferentialDiffTableOfContentsView' => 'applications/differential/view/difftableofcontents',
|
||||
'DifferentialDiffViewController' => 'applications/differential/controller/diffview',
|
||||
'DifferentialExceptionMail' => 'applications/differential/mail/exception',
|
||||
'DifferentialFieldSelector' => 'applications/differential/field/selector/base',
|
||||
'DifferentialFieldSpecification' => 'applications/differential/field/specification/base',
|
||||
'DifferentialHunk' => 'applications/differential/storage/hunk',
|
||||
'DifferentialInlineComment' => 'applications/differential/storage/inlinecomment',
|
||||
'DifferentialInlineCommentEditController' => 'applications/differential/controller/inlinecommentedit',
|
||||
|
@ -766,6 +770,7 @@ phutil_register_library_map(array(
|
|||
'DarkConsoleServicesPlugin' => 'DarkConsolePlugin',
|
||||
'DarkConsoleXHProfPlugin' => 'DarkConsolePlugin',
|
||||
'DifferentialAddCommentView' => 'AphrontView',
|
||||
'DifferentialAuxiliaryField' => 'DifferentialDAO',
|
||||
'DifferentialCCWelcomeMail' => 'DifferentialReviewRequestMail',
|
||||
'DifferentialChangeset' => 'DifferentialDAO',
|
||||
'DifferentialChangesetDetailView' => 'AphrontView',
|
||||
|
@ -777,6 +782,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialCommentSaveController' => 'DifferentialController',
|
||||
'DifferentialController' => 'PhabricatorController',
|
||||
'DifferentialDAO' => 'PhabricatorLiskDAO',
|
||||
'DifferentialDefaultFieldSelector' => 'DifferentialFieldSelector',
|
||||
'DifferentialDiff' => 'DifferentialDAO',
|
||||
'DifferentialDiffContentMail' => 'DifferentialMail',
|
||||
'DifferentialDiffCreateController' => 'DifferentialController',
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
abstract class DifferentialFieldSelector {
|
||||
|
||||
final public function __construct() {
|
||||
// <empty>
|
||||
}
|
||||
|
||||
final public static function newSelector() {
|
||||
$class = PhabricatorEnv::getEnvConfig('differential.field-selector');
|
||||
$selector = newv($class, array());
|
||||
return $selector;
|
||||
}
|
||||
|
||||
abstract public function getFieldSpecifications();
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('DifferentialFieldSelector.php');
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class DifferentialDefaultFieldSelector
|
||||
extends DifferentialFieldSelector {
|
||||
|
||||
public function getFieldSpecifications() {
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/differential/field/selector/base');
|
||||
|
||||
|
||||
phutil_require_source('DifferentialDefaultFieldSelector.php');
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
abstract class DifferentialFieldSpecification {
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
phutil_require_source('DifferentialFieldSpecification.php');
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class DifferentialAuxiliaryField extends DifferentialDAO {
|
||||
|
||||
protected $revisionPHID;
|
||||
protected $name;
|
||||
protected $value;
|
||||
|
||||
public function setName($name) {
|
||||
if (strlen($name) > 32) {
|
||||
throw new Exception(
|
||||
"Tried to set name '{$name}' for a Differential auxiliary field; ".
|
||||
"auxiliary field names must be no longer than 32 characters.");
|
||||
}
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/base');
|
||||
|
||||
|
||||
phutil_require_source('DifferentialAuxiliaryField.php');
|
Loading…
Reference in a new issue