2011-08-18 00:19:48 +02:00
|
|
|
<?php
|
|
|
|
|
Rename Conduit classes
Summary: Ref T5655. Rename Conduit classes and provide a `getAPIMethodName` method to declare the API method.
Test Plan:
```
> echo '{}' | arc --conduit-uri='http://phabricator.joshuaspence.com' call-conduit user.whoami
Waiting for JSON parameters on stdin...
{"error":null,"errorMessage":null,"response":{"phid":"PHID-USER-lioqffnwn6y475mu5ndb","userName":"josh","realName":"Joshua Spence","image":"http:\/\/phabricator.joshuaspence.com\/res\/1404425321T\/phabricator\/3eb28cd9\/rsrc\/image\/avatar.png","uri":"http:\/\/phabricator.joshuaspence.com\/p\/josh\/","roles":["admin","verified","approved","activated"]}}
```
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin, hach-que
Maniphest Tasks: T5655
Differential Revision: https://secure.phabricator.com/D9991
2014-07-25 02:54:15 +02:00
|
|
|
abstract class ManiphestConduitAPIMethod extends ConduitAPIMethod {
|
2011-08-18 00:19:48 +02:00
|
|
|
|
Rename Conduit classes
Summary: Ref T5655. Rename Conduit classes and provide a `getAPIMethodName` method to declare the API method.
Test Plan:
```
> echo '{}' | arc --conduit-uri='http://phabricator.joshuaspence.com' call-conduit user.whoami
Waiting for JSON parameters on stdin...
{"error":null,"errorMessage":null,"response":{"phid":"PHID-USER-lioqffnwn6y475mu5ndb","userName":"josh","realName":"Joshua Spence","image":"http:\/\/phabricator.joshuaspence.com\/res\/1404425321T\/phabricator\/3eb28cd9\/rsrc\/image\/avatar.png","uri":"http:\/\/phabricator.joshuaspence.com\/p\/josh\/","roles":["admin","verified","approved","activated"]}}
```
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin, hach-que
Maniphest Tasks: T5655
Differential Revision: https://secure.phabricator.com/D9991
2014-07-25 02:54:15 +02:00
|
|
|
final public function getApplication() {
|
2013-03-13 15:09:05 +01:00
|
|
|
return PhabricatorApplication::getByClass(
|
2014-07-23 02:03:09 +02:00
|
|
|
'PhabricatorManiphestApplication');
|
2013-03-13 15:09:05 +01:00
|
|
|
}
|
|
|
|
|
2012-05-20 01:18:13 +02:00
|
|
|
public function defineErrorTypes() {
|
|
|
|
return array(
|
2014-07-23 02:03:09 +02:00
|
|
|
'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
|
2012-05-20 01:18:13 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-08-18 00:19:48 +02:00
|
|
|
protected function buildTaskInfoDictionary(ManiphestTask $task) {
|
2011-08-27 01:52:57 +02:00
|
|
|
$results = $this->buildTaskInfoDictionaries(array($task));
|
|
|
|
return idx($results, $task->getPHID());
|
|
|
|
}
|
|
|
|
|
2012-01-06 04:02:50 +01:00
|
|
|
protected function getTaskFields($is_new) {
|
|
|
|
$fields = array();
|
|
|
|
|
|
|
|
if (!$is_new) {
|
|
|
|
$fields += array(
|
2014-07-23 02:03:09 +02:00
|
|
|
'id' => 'optional int',
|
|
|
|
'phid' => 'optional int',
|
2012-01-06 04:02:50 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$fields += array(
|
|
|
|
'title' => $is_new ? 'required string' : 'optional string',
|
|
|
|
'description' => 'optional string',
|
|
|
|
'ownerPHID' => 'optional phid',
|
2014-08-12 23:07:27 +02:00
|
|
|
'viewPolicy' => 'optional phid or policy string',
|
|
|
|
'editPolicy' => 'optional phid or policy string',
|
2012-01-06 04:02:50 +01:00
|
|
|
'ccPHIDs' => 'optional list<phid>',
|
|
|
|
'priority' => 'optional int',
|
|
|
|
'projectPHIDs' => 'optional list<phid>',
|
|
|
|
'auxiliary' => 'optional dict',
|
|
|
|
);
|
|
|
|
|
|
|
|
if (!$is_new) {
|
|
|
|
$fields += array(
|
2014-10-06 20:06:23 +02:00
|
|
|
'status' => 'optional string',
|
2012-01-06 04:02:50 +01:00
|
|
|
'comments' => 'optional string',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $fields;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function applyRequest(
|
|
|
|
ManiphestTask $task,
|
|
|
|
ConduitAPIRequest $request,
|
|
|
|
$is_new) {
|
|
|
|
|
|
|
|
$changes = array();
|
|
|
|
|
|
|
|
if ($is_new) {
|
|
|
|
$task->setTitle((string)$request->getValue('title'));
|
|
|
|
$task->setDescription((string)$request->getValue('description'));
|
2013-09-25 20:16:43 +02:00
|
|
|
$changes[ManiphestTransaction::TYPE_STATUS] =
|
2014-02-18 00:59:31 +01:00
|
|
|
ManiphestTaskStatus::getDefaultStatus();
|
2014-12-11 01:27:30 +01:00
|
|
|
$changes[PhabricatorTransactions::TYPE_SUBSCRIBERS] =
|
|
|
|
array('+' => array($request->getUser()->getPHID()));
|
2012-01-06 04:02:50 +01:00
|
|
|
} else {
|
|
|
|
|
|
|
|
$comments = $request->getValue('comments');
|
|
|
|
if (!$is_new && $comments !== null) {
|
Migrate all Maniphest transaction data to new storage
Summary:
Ref T2217. This is the risky, hard part; everything after this should be smooth sailing. This is //mostly// clean, except:
- The old format would opportunistically combine a comment with some other transaction type if it could. We no longer do that, so:
- When migrating, "edit" + "comment" transactions need to be split in two.
- When editing now, we should no longer combine these transaction types.
- These changes are pretty straightforward and low-impact.
- This migration promotes "auxiliary field" data to the new CustomField/StandardField format, so that's not a straight migration either. The formats are very similar, though.
Broadly, this takes the same attack that the auth migration did: proxy all the code through to the new storage. `ManiphestTransaction` is now just an API on top of `ManiphestTransactionPro`, which is the new storage format. The two formats are very similar, so this was mostly a straight copy from one table to the other.
Test Plan:
- Without performing the migration, made a bunch of edits and comments on tasks and verified the new code works correctly.
- Droped the test data and performed the migration.
- Looked at the resulting data for obvious discrepancies.
- Looked at a bunch of tasks and their transaction history.
- Used Conduit to pull transaction data.
- Edited task description and clicked "View Details" on transaction.
- Used batch editor.
- Made a bunch more edits.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2217
Differential Revision: https://secure.phabricator.com/D7068
2013-09-23 23:25:28 +02:00
|
|
|
$changes[PhabricatorTransactions::TYPE_COMMENT] = null;
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$title = $request->getValue('title');
|
|
|
|
if ($title !== null) {
|
2013-09-25 20:16:43 +02:00
|
|
|
$changes[ManiphestTransaction::TYPE_TITLE] = $title;
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$desc = $request->getValue('description');
|
|
|
|
if ($desc !== null) {
|
2013-09-25 20:16:43 +02:00
|
|
|
$changes[ManiphestTransaction::TYPE_DESCRIPTION] = $desc;
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$status = $request->getValue('status');
|
|
|
|
if ($status !== null) {
|
2012-05-20 01:18:13 +02:00
|
|
|
$valid_statuses = ManiphestTaskStatus::getTaskStatusMap();
|
|
|
|
if (!isset($valid_statuses[$status])) {
|
|
|
|
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
|
|
|
|
->setErrorDescription('Status set to invalid value.');
|
|
|
|
}
|
2013-09-25 20:16:43 +02:00
|
|
|
$changes[ManiphestTransaction::TYPE_STATUS] = $status;
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$priority = $request->getValue('priority');
|
|
|
|
if ($priority !== null) {
|
2012-05-20 01:18:13 +02:00
|
|
|
$valid_priorities = ManiphestTaskPriority::getTaskPriorityMap();
|
|
|
|
if (!isset($valid_priorities[$priority])) {
|
|
|
|
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
|
|
|
|
->setErrorDescription('Priority set to invalid value.');
|
|
|
|
}
|
2013-09-25 20:16:43 +02:00
|
|
|
$changes[ManiphestTransaction::TYPE_PRIORITY] = $priority;
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$owner_phid = $request->getValue('ownerPHID');
|
|
|
|
if ($owner_phid !== null) {
|
2014-07-10 00:12:48 +02:00
|
|
|
$this->validatePHIDList(
|
|
|
|
array($owner_phid),
|
2014-07-24 00:05:46 +02:00
|
|
|
PhabricatorPeopleUserPHIDType::TYPECONST,
|
2014-07-10 00:12:48 +02:00
|
|
|
'ownerPHID');
|
2013-09-25 20:16:43 +02:00
|
|
|
$changes[ManiphestTransaction::TYPE_OWNER] = $owner_phid;
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$ccs = $request->getValue('ccPHIDs');
|
|
|
|
if ($ccs !== null) {
|
2014-12-11 01:27:30 +01:00
|
|
|
$changes[PhabricatorTransactions::TYPE_SUBSCRIBERS] =
|
|
|
|
array('=' => array_fuse($ccs));
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
|
2014-07-18 00:43:40 +02:00
|
|
|
$transactions = array();
|
|
|
|
|
2014-08-12 23:07:27 +02:00
|
|
|
$view_policy = $request->getValue('viewPolicy');
|
|
|
|
if ($view_policy !== null) {
|
|
|
|
$transactions[] = id(new ManiphestTransaction())
|
|
|
|
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
|
|
|
|
->setNewValue($view_policy);
|
|
|
|
}
|
|
|
|
|
|
|
|
$edit_policy = $request->getValue('editPolicy');
|
|
|
|
if ($edit_policy !== null) {
|
|
|
|
$transactions[] = id(new ManiphestTransaction())
|
|
|
|
->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
|
|
|
|
->setNewValue($edit_policy);
|
|
|
|
}
|
|
|
|
|
2012-01-06 04:02:50 +01:00
|
|
|
$project_phids = $request->getValue('projectPHIDs');
|
|
|
|
if ($project_phids !== null) {
|
2014-07-10 00:12:48 +02:00
|
|
|
$this->validatePHIDList(
|
|
|
|
$project_phids,
|
2014-07-24 00:05:46 +02:00
|
|
|
PhabricatorProjectProjectPHIDType::TYPECONST,
|
2014-07-10 00:12:48 +02:00
|
|
|
'projectPHIDS');
|
2014-07-18 00:43:40 +02:00
|
|
|
|
|
|
|
$project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
|
|
|
|
$transactions[] = id(new ManiphestTransaction())
|
|
|
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
|
|
|
->setMetadataValue('edge:type', $project_type)
|
|
|
|
->setNewValue(
|
|
|
|
array(
|
|
|
|
'=' => array_fuse($project_phids),
|
|
|
|
));
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
|
2013-09-24 19:49:06 +02:00
|
|
|
$template = new ManiphestTransaction();
|
2012-01-06 04:02:50 +01:00
|
|
|
|
|
|
|
foreach ($changes as $type => $value) {
|
|
|
|
$transaction = clone $template;
|
|
|
|
$transaction->setTransactionType($type);
|
Migrate all Maniphest transaction data to new storage
Summary:
Ref T2217. This is the risky, hard part; everything after this should be smooth sailing. This is //mostly// clean, except:
- The old format would opportunistically combine a comment with some other transaction type if it could. We no longer do that, so:
- When migrating, "edit" + "comment" transactions need to be split in two.
- When editing now, we should no longer combine these transaction types.
- These changes are pretty straightforward and low-impact.
- This migration promotes "auxiliary field" data to the new CustomField/StandardField format, so that's not a straight migration either. The formats are very similar, though.
Broadly, this takes the same attack that the auth migration did: proxy all the code through to the new storage. `ManiphestTransaction` is now just an API on top of `ManiphestTransactionPro`, which is the new storage format. The two formats are very similar, so this was mostly a straight copy from one table to the other.
Test Plan:
- Without performing the migration, made a bunch of edits and comments on tasks and verified the new code works correctly.
- Droped the test data and performed the migration.
- Looked at the resulting data for obvious discrepancies.
- Looked at a bunch of tasks and their transaction history.
- Used Conduit to pull transaction data.
- Edited task description and clicked "View Details" on transaction.
- Used batch editor.
- Made a bunch more edits.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2217
Differential Revision: https://secure.phabricator.com/D7068
2013-09-23 23:25:28 +02:00
|
|
|
if ($type == PhabricatorTransactions::TYPE_COMMENT) {
|
2013-09-23 23:32:08 +02:00
|
|
|
$transaction->attachComment(
|
|
|
|
id(new ManiphestTransactionComment())
|
|
|
|
->setContent($comments));
|
|
|
|
} else {
|
|
|
|
$transaction->setNewValue($value);
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
2013-09-23 23:32:08 +02:00
|
|
|
|
2012-01-06 04:02:50 +01:00
|
|
|
$transactions[] = $transaction;
|
|
|
|
}
|
|
|
|
|
2013-09-17 01:03:01 +02:00
|
|
|
$field_list = PhabricatorCustomField::getObjectFields(
|
|
|
|
$task,
|
|
|
|
PhabricatorCustomField::ROLE_EDIT);
|
2013-09-23 23:32:08 +02:00
|
|
|
$field_list->readFieldsFromStorage($task);
|
2013-09-17 01:03:01 +02:00
|
|
|
|
2012-01-06 04:02:50 +01:00
|
|
|
$auxiliary = $request->getValue('auxiliary');
|
|
|
|
if ($auxiliary) {
|
2013-09-17 01:03:01 +02:00
|
|
|
foreach ($field_list->getFields() as $key => $field) {
|
|
|
|
if (!array_key_exists($key, $auxiliary)) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-01-06 04:02:50 +01:00
|
|
|
$transaction = clone $template;
|
|
|
|
$transaction->setTransactionType(
|
Migrate all Maniphest transaction data to new storage
Summary:
Ref T2217. This is the risky, hard part; everything after this should be smooth sailing. This is //mostly// clean, except:
- The old format would opportunistically combine a comment with some other transaction type if it could. We no longer do that, so:
- When migrating, "edit" + "comment" transactions need to be split in two.
- When editing now, we should no longer combine these transaction types.
- These changes are pretty straightforward and low-impact.
- This migration promotes "auxiliary field" data to the new CustomField/StandardField format, so that's not a straight migration either. The formats are very similar, though.
Broadly, this takes the same attack that the auth migration did: proxy all the code through to the new storage. `ManiphestTransaction` is now just an API on top of `ManiphestTransactionPro`, which is the new storage format. The two formats are very similar, so this was mostly a straight copy from one table to the other.
Test Plan:
- Without performing the migration, made a bunch of edits and comments on tasks and verified the new code works correctly.
- Droped the test data and performed the migration.
- Looked at the resulting data for obvious discrepancies.
- Looked at a bunch of tasks and their transaction history.
- Used Conduit to pull transaction data.
- Edited task description and clicked "View Details" on transaction.
- Used batch editor.
- Made a bunch more edits.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2217
Differential Revision: https://secure.phabricator.com/D7068
2013-09-23 23:25:28 +02:00
|
|
|
PhabricatorTransactions::TYPE_CUSTOMFIELD);
|
|
|
|
$transaction->setMetadataValue('customfield:key', $key);
|
2013-09-17 01:03:01 +02:00
|
|
|
$transaction->setOldValue(
|
|
|
|
$field->getOldValueForApplicationTransactions());
|
|
|
|
$transaction->setNewValue($auxiliary[$key]);
|
2012-01-06 04:02:50 +01:00
|
|
|
$transactions[] = $transaction;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-17 01:03:01 +02:00
|
|
|
if (!$transactions) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-01-06 04:02:50 +01:00
|
|
|
$event = new PhabricatorEvent(
|
|
|
|
PhabricatorEventType::TYPE_MANIPHEST_WILLEDITTASK,
|
|
|
|
array(
|
|
|
|
'task' => $task,
|
|
|
|
'new' => $is_new,
|
|
|
|
'transactions' => $transactions,
|
|
|
|
));
|
|
|
|
$event->setUser($request->getUser());
|
|
|
|
$event->setConduitRequest($request);
|
|
|
|
PhutilEventEngine::dispatchEvent($event);
|
|
|
|
|
|
|
|
$task = $event->getValue('task');
|
|
|
|
$transactions = $event->getValue('transactions');
|
|
|
|
|
2013-09-23 23:32:08 +02:00
|
|
|
$content_source = PhabricatorContentSource::newForSource(
|
|
|
|
PhabricatorContentSource::SOURCE_CONDUIT,
|
|
|
|
array());
|
|
|
|
|
2013-10-22 01:58:37 +02:00
|
|
|
$editor = id(new ManiphestTransactionEditor())
|
2013-09-23 23:32:08 +02:00
|
|
|
->setActor($request->getUser())
|
|
|
|
->setContentSource($content_source)
|
|
|
|
->setContinueOnNoEffect(true);
|
|
|
|
|
2013-09-23 23:32:32 +02:00
|
|
|
if (!$is_new) {
|
|
|
|
$editor->setContinueOnMissingFields(true);
|
|
|
|
}
|
|
|
|
|
2012-01-06 04:02:50 +01:00
|
|
|
$editor->applyTransactions($task, $transactions);
|
2012-04-17 21:09:04 +02:00
|
|
|
|
|
|
|
$event = new PhabricatorEvent(
|
|
|
|
PhabricatorEventType::TYPE_MANIPHEST_DIDEDITTASK,
|
|
|
|
array(
|
|
|
|
'task' => $task,
|
|
|
|
'new' => $is_new,
|
|
|
|
'transactions' => $transactions,
|
|
|
|
));
|
|
|
|
$event->setUser($request->getUser());
|
|
|
|
$event->setConduitRequest($request);
|
|
|
|
PhutilEventEngine::dispatchEvent($event);
|
2014-12-11 01:27:30 +01:00
|
|
|
|
|
|
|
// reload the task now that we've done all the fun stuff
|
|
|
|
return id(new ManiphestTaskQuery())
|
|
|
|
->setViewer($request->getUser())
|
|
|
|
->withPHIDs(array($task->getPHID()))
|
|
|
|
->needSubscriberPHIDs(true)
|
2014-12-18 22:53:45 +01:00
|
|
|
->needProjectPHIDs(true)
|
2014-12-11 01:27:30 +01:00
|
|
|
->executeOne();
|
2012-01-06 04:02:50 +01:00
|
|
|
}
|
|
|
|
|
2011-08-27 01:52:57 +02:00
|
|
|
protected function buildTaskInfoDictionaries(array $tasks) {
|
2012-04-03 21:10:45 +02:00
|
|
|
assert_instances_of($tasks, 'ManiphestTask');
|
2011-08-27 01:52:57 +02:00
|
|
|
if (!$tasks) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2013-05-10 19:17:03 +02:00
|
|
|
$task_phids = mpull($tasks, 'getPHID');
|
|
|
|
|
|
|
|
$all_deps = id(new PhabricatorEdgeQuery())
|
|
|
|
->withSourcePHIDs($task_phids)
|
2014-12-28 15:10:49 +01:00
|
|
|
->withEdgeTypes(array(ManiphestTaskDependsOnTaskEdgeType::EDGECONST));
|
2013-05-10 19:17:03 +02:00
|
|
|
$all_deps->execute();
|
|
|
|
|
2011-08-27 01:52:57 +02:00
|
|
|
$result = array();
|
|
|
|
foreach ($tasks as $task) {
|
2013-09-17 01:02:06 +02:00
|
|
|
// TODO: Batch this get as CustomField gets cleaned up.
|
2013-09-17 01:03:01 +02:00
|
|
|
$field_list = PhabricatorCustomField::getObjectFields(
|
|
|
|
$task,
|
|
|
|
PhabricatorCustomField::ROLE_EDIT);
|
|
|
|
$field_list->readFieldsFromStorage($task);
|
|
|
|
|
|
|
|
$auxiliary = mpull(
|
|
|
|
$field_list->getFields(),
|
|
|
|
'getValueForStorage',
|
|
|
|
'getFieldKey');
|
2011-08-27 01:52:57 +02:00
|
|
|
|
2013-05-10 19:17:03 +02:00
|
|
|
$task_deps = $all_deps->getDestinationPHIDs(
|
|
|
|
array($task->getPHID()),
|
2014-12-28 15:10:49 +01:00
|
|
|
array(ManiphestTaskDependsOnTaskEdgeType::EDGECONST));
|
2013-05-10 19:17:03 +02:00
|
|
|
|
2011-08-27 01:52:57 +02:00
|
|
|
$result[$task->getPHID()] = array(
|
|
|
|
'id' => $task->getID(),
|
|
|
|
'phid' => $task->getPHID(),
|
|
|
|
'authorPHID' => $task->getAuthorPHID(),
|
|
|
|
'ownerPHID' => $task->getOwnerPHID(),
|
2014-12-11 01:27:30 +01:00
|
|
|
'ccPHIDs' => $task->getSubscriberPHIDs(),
|
2011-08-27 01:52:57 +02:00
|
|
|
'status' => $task->getStatus(),
|
2014-04-09 16:47:31 +02:00
|
|
|
'statusName' => ManiphestTaskStatus::getTaskStatusName(
|
|
|
|
$task->getStatus()),
|
|
|
|
'isClosed' => $task->isClosed(),
|
2011-08-27 01:52:57 +02:00
|
|
|
'priority' => ManiphestTaskPriority::getTaskPriorityName(
|
|
|
|
$task->getPriority()),
|
2014-04-09 20:32:08 +02:00
|
|
|
'priorityColor' => ManiphestTaskPriority::getTaskPriorityColor(
|
|
|
|
$task->getPriority()),
|
2011-08-27 01:52:57 +02:00
|
|
|
'title' => $task->getTitle(),
|
|
|
|
'description' => $task->getDescription(),
|
|
|
|
'projectPHIDs' => $task->getProjectPHIDs(),
|
|
|
|
'uri' => PhabricatorEnv::getProductionURI('/T'.$task->getID()),
|
|
|
|
'auxiliary' => $auxiliary,
|
|
|
|
|
|
|
|
'objectName' => 'T'.$task->getID(),
|
|
|
|
'dateCreated' => $task->getDateCreated(),
|
|
|
|
'dateModified' => $task->getDateModified(),
|
2013-05-10 19:17:03 +02:00
|
|
|
'dependsOnTaskPHIDs' => $task_deps,
|
2011-08-27 01:52:57 +02:00
|
|
|
);
|
|
|
|
}
|
2011-08-18 00:19:48 +02:00
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
2012-05-20 01:18:13 +02:00
|
|
|
/**
|
2014-07-23 02:03:09 +02:00
|
|
|
* NOTE: This is a temporary stop gap since its easy to make malformed tasks.
|
2012-05-20 01:18:13 +02:00
|
|
|
* Long-term, the values set in @{method:defineParamTypes} will be used to
|
|
|
|
* validate data implicitly within the larger Conduit application.
|
|
|
|
*
|
2014-07-23 02:03:09 +02:00
|
|
|
* TODO: Remove this in favor of generalized Conduit hotness.
|
2012-05-20 01:18:13 +02:00
|
|
|
*/
|
|
|
|
private function validatePHIDList(array $phid_list, $phid_type, $field) {
|
|
|
|
$phid_groups = phid_group_by_type($phid_list);
|
|
|
|
unset($phid_groups[$phid_type]);
|
|
|
|
if (!empty($phid_groups)) {
|
|
|
|
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
|
2014-07-23 02:03:09 +02:00
|
|
|
->setErrorDescription('One or more PHIDs were invalid for '.$field.'.');
|
2012-05-20 01:18:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-08-18 00:19:48 +02:00
|
|
|
}
|