mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-12 07:41:04 +01:00
d804598f17
Summary: Ref T6881. This adds the worker, and a script to make it easier to test. It doesn't actually invoice anything. I'm intentionally allowing the script to double-bill since it makes testing way easier (by letting you bill the same period over and over again), and provides a tool for recovery if billing screws up. (This diff isn't very interesting, just trying to avoid a 5K-line diff at the end.) Test Plan: Used `bin/phortune invoice ...` to get the worker to print out some date ranges which it would theoretically invoice. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T6881 Differential Revision: https://secure.phabricator.com/D11577
29 lines
684 B
PHP
29 lines
684 B
PHP
<?php
|
|
|
|
abstract class PhabricatorManagementWorkflow extends PhutilArgumentWorkflow {
|
|
|
|
public function isExecutable() {
|
|
return true;
|
|
}
|
|
|
|
public function getViewer() {
|
|
// Some day, we might provide a more general viewer mechanism to scripts.
|
|
// For now, workflows can call this method for convenience and future
|
|
// flexibility.
|
|
return PhabricatorUser::getOmnipotentUser();
|
|
}
|
|
|
|
protected function parseTimeArgument($time) {
|
|
if (!strlen($time)) {
|
|
return null;
|
|
}
|
|
|
|
$epoch = strtotime($time);
|
|
if ($epoch <= 0) {
|
|
throw new PhutilArgumentUsageException(
|
|
pht('Unable to parse time "%s".', $time));
|
|
}
|
|
return $epoch;
|
|
}
|
|
|
|
}
|