PHRAS-3894 : bin/maintenance clean: - Removing BETA prefix and Memory leak (#4391)

* remove beta

* prefix beta in description
This commit is contained in:
Aina Sitraka
2023-10-10 21:43:30 +03:00
committed by GitHub
parent 0c52d94659
commit be9a6b3ed3
3 changed files with 32 additions and 9 deletions

View File

@@ -14,10 +14,10 @@ class CleanLogDocsCommand extends Command
public function __construct()
{
parent::__construct('BETA - Clean:log_docs');
parent::__construct('clean:log_docs');
$this
->setDescription('clean the log_docs for all databox (if not specified) or a specific databox_id ')
->setDescription('Beta - clean the log_docs for all databox (if not specified) or a specific databox_id ')
->addOption('databox_id', null, InputOption::VALUE_REQUIRED, 'the databox to clean')
->addOption('older_than', null, InputOption::VALUE_REQUIRED, 'delete older than <OLDER_THAN>')
->addOption('action', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'download, mail, ftp, delete (if delete , delete also log entry for all events like push, add , validate, edit, collection, status, print, substit, publish for this record_id)')
@@ -112,11 +112,19 @@ class CleanLogDocsCommand extends Command
}
$output->writeln(sprintf("\n \n dry-run , %d log docs entry to delete for databox %s", count($rowsActionDelete), $databox->get_dbname()));
// displayed only the 1000 first row to avoid memory leak
$displayedRows = array_slice($rowsActionDelete, 0, 1000);
if (count($rows) > 1000) {
array_push($displayedRows, array_fill_keys(['id', 'log_id', 'date', 'record_id', 'final', 'action'], ' ... '));
array_push($displayedRows, array_fill_keys(['id', 'log_id', 'date', 'record_id', 'final', 'action'], ' ... '));
}
$logEntryTable = $this->getHelperSet()->get('table');
$headers = ['id', 'log_id', 'date', 'record_id', 'final', 'action'];
$logEntryTable
->setHeaders($headers)
->setRows($rowsActionDelete)
->setRows($displayedRows)
->render($output);
} else {