DeletedRecordsCommand extends Command
Force-deletes all records in the database which have a deleted=1 flag
Table of Contents
Methods
- __construct() : mixed
- configure() : mixed
- Configure the command by defining the name, options and arguments
- deleteRecords() : void
- Deletes records via DataHandler
- execute() : int
- Executes the command to find and permanently delete records which are marked as deleted
- findAllFlaggedRecordsInPage() : array<string|int, mixed>
- Recursive traversal of page tree to fetch all records marked as "deleted", via option $GLOBALS[TCA][$tableName][ctrl][delete] This also takes deleted versioned records into account.
- getTablesWithFlag() : array<string|int, mixed>
- Fetches all tables registered in the TCA with a $flag and that are not pages (which are handled separately).
Methods
__construct()
public
__construct(ConnectionPool $connectionPool) : mixed
Parameters
- $connectionPool : ConnectionPool
configure()
Configure the command by defining the name, options and arguments
public
configure() : mixed
deleteRecords()
Deletes records via DataHandler
protected
deleteRecords(array<string|int, mixed> $deletedRecords, bool $dryRun, SymfonyStyle $io) : void
Parameters
- $deletedRecords : array<string|int, mixed>
-
two level array with tables and uids
- $dryRun : bool
-
check if the records should NOT be deleted (use --dry-run to avoid)
- $io : SymfonyStyle
execute()
Executes the command to find and permanently delete records which are marked as deleted
protected
execute(InputInterface $input, OutputInterface $output) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
Return values
intfindAllFlaggedRecordsInPage()
Recursive traversal of page tree to fetch all records marked as "deleted", via option $GLOBALS[TCA][$tableName][ctrl][delete] This also takes deleted versioned records into account.
protected
findAllFlaggedRecordsInPage(int $pageId, int $depth, int $maximumTimestamp[, array<string|int, mixed> $deletedRecords = [] ]) : array<string|int, mixed>
Parameters
- $pageId : int
-
the uid of the pages record (can also be 0)
- $depth : int
-
The current depth of levels to go down
- $maximumTimestamp : int
-
maximum value of records tstamp
- $deletedRecords : array<string|int, mixed> = []
-
the records that are already marked as deleted (used when going recursive)
Return values
array<string|int, mixed> —the modified $deletedRecords array
getTablesWithFlag()
Fetches all tables registered in the TCA with a $flag and that are not pages (which are handled separately).
protected
getTablesWithFlag(string $flag) : array<string|int, mixed>
Parameters
- $flag : string