mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
Key Value Store for ManiphestTask
Test Plan: Look at a task detail. Some dummy attributes are automatically added in ManiphestTaskDetailController. Reviewed By: epriestley Differential Revision: 730
This commit is contained in:
parent
e00fae8436
commit
aeae33b7d6
8 changed files with 93 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -8,3 +8,6 @@
|
||||||
*#
|
*#
|
||||||
*~
|
*~
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
|
# NetBeans project files
|
||||||
|
/nbproject/
|
||||||
|
|
9
resources/sql/patches/068.maniphestauxiliarystorage.sql
Normal file
9
resources/sql/patches/068.maniphestauxiliarystorage.sql
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
create table phabricator_maniphest.maniphest_taskauxiliarystorage
|
||||||
|
(id int unsigned not null auto_increment primary key,
|
||||||
|
taskPHID varchar(64) binary not null,
|
||||||
|
name varchar(255) not null,
|
||||||
|
value varchar(255) not null,
|
||||||
|
unique key (taskPHID,name),
|
||||||
|
dateCreated int unsigned not null,
|
||||||
|
dateModified int unsigned not null)
|
||||||
|
ENGINE = InnoDB;
|
|
@ -268,6 +268,7 @@ phutil_register_library_map(array(
|
||||||
'ManiphestDAO' => 'applications/maniphest/storage/base',
|
'ManiphestDAO' => 'applications/maniphest/storage/base',
|
||||||
'ManiphestReplyHandler' => 'applications/maniphest/replyhandler',
|
'ManiphestReplyHandler' => 'applications/maniphest/replyhandler',
|
||||||
'ManiphestTask' => 'applications/maniphest/storage/task',
|
'ManiphestTask' => 'applications/maniphest/storage/task',
|
||||||
|
'ManiphestTaskAuxiliaryStorage' => 'applications/maniphest/storage/auxiliary',
|
||||||
'ManiphestTaskDescriptionChangeController' => 'applications/maniphest/controller/descriptionchange',
|
'ManiphestTaskDescriptionChangeController' => 'applications/maniphest/controller/descriptionchange',
|
||||||
'ManiphestTaskDetailController' => 'applications/maniphest/controller/taskdetail',
|
'ManiphestTaskDetailController' => 'applications/maniphest/controller/taskdetail',
|
||||||
'ManiphestTaskEditController' => 'applications/maniphest/controller/taskedit',
|
'ManiphestTaskEditController' => 'applications/maniphest/controller/taskedit',
|
||||||
|
@ -826,6 +827,7 @@ phutil_register_library_map(array(
|
||||||
'ManiphestDAO' => 'PhabricatorLiskDAO',
|
'ManiphestDAO' => 'PhabricatorLiskDAO',
|
||||||
'ManiphestReplyHandler' => 'PhabricatorMailReplyHandler',
|
'ManiphestReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||||
'ManiphestTask' => 'ManiphestDAO',
|
'ManiphestTask' => 'ManiphestDAO',
|
||||||
|
'ManiphestTaskAuxiliaryStorage' => 'ManiphestDAO',
|
||||||
'ManiphestTaskDescriptionChangeController' => 'ManiphestController',
|
'ManiphestTaskDescriptionChangeController' => 'ManiphestController',
|
||||||
'ManiphestTaskDetailController' => 'ManiphestController',
|
'ManiphestTaskDetailController' => 'ManiphestController',
|
||||||
'ManiphestTaskEditController' => 'ManiphestController',
|
'ManiphestTaskEditController' => 'ManiphestController',
|
||||||
|
|
|
@ -141,7 +141,6 @@ class ManiphestTaskDetailController extends ManiphestController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$dict['Description'] =
|
$dict['Description'] =
|
||||||
'<div class="maniphest-task-description">'.
|
'<div class="maniphest-task-description">'.
|
||||||
'<div class="phabricator-remarkup">'.
|
'<div class="phabricator-remarkup">'.
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group maniphest
|
||||||
|
*/
|
||||||
|
class ManiphestTaskAuxiliaryStorage extends ManiphestDAO {
|
||||||
|
|
||||||
|
protected $taskPHID;
|
||||||
|
protected $name;
|
||||||
|
protected $value;
|
||||||
|
|
||||||
|
}
|
12
src/applications/maniphest/storage/auxiliary/__init__.php
Normal file
12
src/applications/maniphest/storage/auxiliary/__init__.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is automatically generated. Lint this module to rebuild it.
|
||||||
|
* @generated
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'applications/maniphest/storage/base');
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_source('ManiphestTaskAuxiliaryStorage.php');
|
|
@ -83,6 +83,44 @@ class ManiphestTask extends ManiphestDAO {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAuxiliaryAttribute($key, $val) {
|
||||||
|
$this->removeAuxiliaryAttribute($key);
|
||||||
|
|
||||||
|
$attribute = new ManiphestTaskAuxiliaryStorage();
|
||||||
|
$attribute->setTaskPHID($this->phid);
|
||||||
|
$attribute->setName($key);
|
||||||
|
$attribute->setValue($val);
|
||||||
|
$attribute->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadAuxiliaryAttribute($key) {
|
||||||
|
$attribute = id(new ManiphestTaskAuxiliaryStorage())->loadOneWhere(
|
||||||
|
'taskPHID = %s AND name = %s',
|
||||||
|
$this->getPHID(),
|
||||||
|
$key);
|
||||||
|
|
||||||
|
return $attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeAuxiliaryAttribute($key) {
|
||||||
|
$attribute = id(new ManiphestTaskAuxiliaryStorage())->loadOneWhere(
|
||||||
|
'taskPHID = %s AND name = %s',
|
||||||
|
$this->getPHID(),
|
||||||
|
$key);
|
||||||
|
|
||||||
|
if ($attribute) {
|
||||||
|
$attribute->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadAuxiliaryAttributes() {
|
||||||
|
$attributes = id(new ManiphestTaskAuxiliaryStorage())->loadAllWhere(
|
||||||
|
'taskPHID = %s',
|
||||||
|
$this->getPHID());
|
||||||
|
|
||||||
|
return $attributes;
|
||||||
|
}
|
||||||
|
|
||||||
public function save() {
|
public function save() {
|
||||||
if (!$this->mailKey) {
|
if (!$this->mailKey) {
|
||||||
$this->mailKey = sha1(Filesystem::readRandomBytes(20));
|
$this->mailKey = sha1(Filesystem::readRandomBytes(20));
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'applications/maniphest/storage/auxiliary');
|
||||||
phutil_require_module('phabricator', 'applications/maniphest/storage/base');
|
phutil_require_module('phabricator', 'applications/maniphest/storage/base');
|
||||||
phutil_require_module('phabricator', 'applications/maniphest/storage/subscriber');
|
phutil_require_module('phabricator', 'applications/maniphest/storage/subscriber');
|
||||||
phutil_require_module('phabricator', 'applications/maniphest/storage/taskproject');
|
phutil_require_module('phabricator', 'applications/maniphest/storage/taskproject');
|
||||||
|
|
Loading…
Reference in a new issue