@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhrequentPushConduitAPIMethod extends PhrequentConduitAPIMethod {
4
5 public function getAPIMethodName() {
6 return 'phrequent.push';
7 }
8
9 public function getMethodDescription() {
10 return pht(
11 'Start tracking time on an object by '.
12 'pushing it on the tracking stack.');
13 }
14
15 protected function defineParamTypes() {
16 return array(
17 'objectPHID' => 'required phid',
18 'startTime' => 'int',
19 );
20 }
21
22 protected function defineReturnType() {
23 return 'phid';
24 }
25
26 protected function execute(ConduitAPIRequest $request) {
27 $user = $request->getUser();
28 $object_phid = $request->getValue('objectPHID');
29 $timestamp = $request->getValue('startTime');
30 if ($timestamp === null) {
31 $timestamp = time();
32 }
33
34 $editor = new PhrequentTrackingEditor();
35 return $editor->startTracking($user, $object_phid, $timestamp);
36 }
37
38}