Historical import of tasks


We are importing defects from a legacy bug tracking system into Maniphest using conduit (maniphest.createtask/edit) using a bot user

At present it shows the Task as having been authored by the bot user with the current date

I would like to set the correct “Authored” by to be the submitter and the correct submit date to be the “authored date”

Does anyone know if such an action is possible?


You need access to the database for this. I did such an import a few months ago (from Github issues to Maniphest) and based my code on kakaroto/github_to_phabricator (itself based on WMF’s wmfphablib.)

(I have been meaning to publish my import code somewhere − will try to pick that up eventually…)


Thanks for the pointers, makes me wonder if it would be hard for me add that capability to edit dateCreated,dateModified and authorPID in the maniphest.edit conduit call, (given that it must surely set those fields on task creation)

Whilst I understand its unlikely upstream would add such support for security reasons… but I’m mirroring those tasks continuously between the legacy system and phabricator, when someone changes something in the legacy system its mirrored into phabricator and vice versa.

So this isn’t a one time thing…hence I need this in the conduit api

So I would really like the bot doing the mirroring to be able to create/update those tasks on behalf of the original person (spoofing their activity in phabricator to match their activity the legacy system)


Probably not something that upstream would be interested in as likely considered a bit of a security issue, but this simple change lets me use a bots account to send updates as a specific user PHID by passing the actingAsUserPHID in the conduit call… maybe with a bit of request->getUser()->isAdminstrator() type code this could be something others would consider useful too.

I thought I’d share it all the same.

diff --git a/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php b/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php
index 3a6dd4b..9922e31 100644
--- a/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngineAPIMethod.php
@@ -15,6 +15,7 @@ abstract class PhabricatorEditEngineAPIMethod
     return array(
       'transactions' => 'list<map<string, wild>>',
       'objectIdentifier' => 'optional id|phid|string',
+      'actingAsUserPHID' => 'optional phid',

@@ -23,8 +24,20 @@ abstract class PhabricatorEditEngineAPIMethod

   final protected function execute(ConduitAPIRequest $request) {
+    $user = $request->getUser();
+    $acting_user= $request->getValue('actingAsUserPHID');
+    if ($acting_user!== null) {
+      $user = id(new PhabricatorPeopleQuery())
+      ->setViewer($user)
+      ->withPHIDs(array($acting_user))
+      ->needUserSettings(true)
+      ->executeOne();
+    }
     $engine = $this->newEditEngine()
-      ->setViewer($request->getUser());
+      ->setViewer($user);

     return $engine->buildConduitResponse($request);