mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
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
2 changed files with 26 additions and 3 deletions
|
@ -7,11 +7,18 @@ final class PhabricatorMailManagementVolumeWorkflow
|
|||
$this
|
||||
->setName('volume')
|
||||
->setSynopsis(
|
||||
pht('Show how much mail users have received in the last 30 days.'))
|
||||
pht('Show how much mail users have received recently.'))
|
||||
->setExamples(
|
||||
'**volume**')
|
||||
->setArguments(
|
||||
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();
|
||||
$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();
|
||||
|
||||
$mails = id(new PhabricatorMetaMTAMailQuery())
|
||||
|
@ -95,7 +111,9 @@ final class PhabricatorMailManagementVolumeWorkflow
|
|||
$table->draw();
|
||||
|
||||
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(
|
||||
'"Unfiltered" is raw volume before rules applied.')."\n";
|
||||
echo pht(
|
||||
|
|
|
@ -1369,6 +1369,11 @@ final class PhabricatorUSEnglishTranslation
|
|||
'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