variable days back for bin/mail volume
Summary: Email is so exciting I can't wait 30 days for initial results. ref T9161 Test Plan: * `./bin/mail volume --days 60` took longer and gave plausibly larger results. * `./bin/mail volume --days 0` quickly told me no mail had been sent. * `./bin/mail volume` Said it was still looking 30 days back. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Maniphest Tasks: T9161 Differential Revision: https://secure.phabricator.com/D13901
This commit is contained in:
parent
328d336c8b
commit
786b135a66
|
@ -7,11 +7,18 @@ final class PhabricatorMailManagementVolumeWorkflow
|
||||||
$this
|
$this
|
||||||
->setName('volume')
|
->setName('volume')
|
||||||
->setSynopsis(
|
->setSynopsis(
|
||||||
pht('Show how much mail users have received in the last 30 days.'))
|
pht('Show how much mail users have received recently.'))
|
||||||
->setExamples(
|
->setExamples(
|
||||||
'**volume**')
|
'**volume**')
|
||||||
->setArguments(
|
->setArguments(
|
||||||
array(
|
array(
|
||||||
|
array(
|
||||||
|
'name' => 'days',
|
||||||
|
'param' => 'days',
|
||||||
|
'default' => 30,
|
||||||
|
'help' => pht(
|
||||||
|
'Number of days back (default 30).'),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +26,16 @@ final class PhabricatorMailManagementVolumeWorkflow
|
||||||
$console = PhutilConsole::getConsole();
|
$console = PhutilConsole::getConsole();
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$since = (PhabricatorTime::getNow() - phutil_units('30 days in seconds'));
|
$days = (int)$args->getArg('days');
|
||||||
|
if ($days < 1) {
|
||||||
|
throw new PhutilArgumentUsageException(
|
||||||
|
pht(
|
||||||
|
'Period specified with --days must be at least 1.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$duration = phutil_units("{$days} days in seconds");
|
||||||
|
|
||||||
|
$since = (PhabricatorTime::getNow() - $duration);
|
||||||
$until = PhabricatorTime::getNow();
|
$until = PhabricatorTime::getNow();
|
||||||
|
|
||||||
$mails = id(new PhabricatorMetaMTAMailQuery())
|
$mails = id(new PhabricatorMetaMTAMailQuery())
|
||||||
|
@ -95,7 +111,9 @@ final class PhabricatorMailManagementVolumeWorkflow
|
||||||
$table->draw();
|
$table->draw();
|
||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo pht('Mail sent in the last 30 days.')."\n";
|
echo pht(
|
||||||
|
'Mail sent in the last %s day(s).',
|
||||||
|
new PhutilNumber($days))."\n";
|
||||||
echo pht(
|
echo pht(
|
||||||
'"Unfiltered" is raw volume before rules applied.')."\n";
|
'"Unfiltered" is raw volume before rules applied.')."\n";
|
||||||
echo pht(
|
echo pht(
|
||||||
|
|
|
@ -1369,6 +1369,11 @@ final class PhabricatorUSEnglishTranslation
|
||||||
'This action has no effect on targets: %2$s.',
|
'This action has no effect on targets: %2$s.',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'Mail sent in the last %s day(s).' => array(
|
||||||
|
'Mail sent in the last day.',
|
||||||
|
'Mail sent in the last %s days.',
|
||||||
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue