Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/management/PhabricatorManagementWorkflow.php
<?php | <?php | ||||
abstract class PhabricatorManagementWorkflow extends PhutilArgumentWorkflow { | abstract class PhabricatorManagementWorkflow extends PhutilArgumentWorkflow { | ||||
public function isExecutable() { | public function isExecutable() { | ||||
return true; | return true; | ||||
} | } | ||||
public function getViewer() { | public function getViewer() { | ||||
// Some day, we might provide a more general viewer mechanism to scripts. | // Some day, we might provide a more general viewer mechanism to scripts. | ||||
// For now, workflows can call this method for convenience and future | // For now, workflows can call this method for convenience and future | ||||
// flexibility. | // flexibility. | ||||
return PhabricatorUser::getOmnipotentUser(); | return PhabricatorUser::getOmnipotentUser(); | ||||
} | } | ||||
protected function parseTimeArgument($time) { | protected function parseTimeArgument($time) { | ||||
if (!strlen($time)) { | if (!phutil_nonempty_string($time)) { | ||||
valerio.bozzolan: This check has sense since then we use `strtotime($time)` so we really want a string, and we… | |||||
return null; | return null; | ||||
} | } | ||||
$epoch = strtotime($time); | $epoch = strtotime($time); | ||||
if ($epoch <= 0) { | if ($epoch <= 0) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht('Unable to parse time "%s".', $time)); | pht('Unable to parse time "%s".', $time)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
This check has sense since then we use strtotime($time) so we really want a string, and we should report alien stuff.