mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-08 00:03:12 +08:00
Support paginating the output of visits commands to avoid out of memory errors
This commit is contained in:
18
module/CLI/src/Input/VisitsListFormat.php
Normal file
18
module/CLI/src/Input/VisitsListFormat.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Shlinkio\Shlink\CLI\Input;
|
||||
|
||||
enum VisitsListFormat: string
|
||||
{
|
||||
/** Load and dump all visits at once, in a human-friendly format */
|
||||
case FULL = 'full';
|
||||
|
||||
/**
|
||||
* Load and dump visits in 1000-visit chunks, in a human-friendly format.
|
||||
* This format is recommended over `default` for large number of visits, to avoid running out of memory.
|
||||
*/
|
||||
case PAGINATED = 'paginated';
|
||||
|
||||
/** Load and dump visits in chunks, in CSV format */
|
||||
case CSV = 'csv';
|
||||
}
|
||||
@@ -18,6 +18,13 @@ class VisitsListInput
|
||||
#[Option('Only return visits newer than this date', shortcut: 'e')]
|
||||
public string|null $endDate = null;
|
||||
|
||||
#[Option(
|
||||
'Output format ("' . VisitsListFormat::FULL->value . '", "' . VisitsListFormat::PAGINATED->value . '" or "'
|
||||
. VisitsListFormat::CSV->value . '")',
|
||||
shortcut: 'f',
|
||||
)]
|
||||
public VisitsListFormat $format = VisitsListFormat::FULL;
|
||||
|
||||
public function dateRange(): DateRange
|
||||
{
|
||||
return buildDateRange(
|
||||
|
||||
Reference in New Issue
Block a user