3 final class PhabricatorAuthManagementUnlimitWorkflow
4 extends PhabricatorAuthManagementWorkflow
{
6 protected function didConstruct() {
9 ->setExamples('**unlimit** --user __username__ --all')
12 'Reset action counters so a user can continue taking '.
13 'rate-limited actions.'))
18 'param' => 'username',
19 'help' => pht('Reset action counters for this user.'),
23 'help' => pht('Reset all counters.'),
28 public function execute(PhutilArgumentParser
$args) {
29 $username = $args->getArg('user');
30 if (!strlen($username)) {
31 throw new PhutilArgumentUsageException(
33 'Use %s to choose a user to reset actions for.', '--user'));
36 $user = id(new PhabricatorPeopleQuery())
37 ->setViewer($this->getViewer())
38 ->withUsernames(array($username))
41 throw new PhutilArgumentUsageException(
43 'No user exists with username "%s".',
47 $all = $args->getArg('all');
49 // TODO: Eventually, let users reset specific actions. For now, we
50 // require `--all` so that usage won't change when you can reset in a
52 throw new PhutilArgumentUsageException(
54 'Specify %s to reset all action counters.', '--all'));
57 $count = PhabricatorSystemActionEngine
::resetActions(
62 echo pht('Reset %s action(s).', new PhutilNumber($count))."\n";