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() : mixed
- 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.
- getTablesWithDeletedFlags() : array<string|int, mixed>
- Fetches all tables registered in the TCA with a deleted 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) : mixed
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[, 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
- $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
getTablesWithDeletedFlags()
Fetches all tables registered in the TCA with a deleted and that are not pages (which are handled separately)
protected
getTablesWithDeletedFlags() : array<string|int, mixed>
Return values
array<string|int, mixed> —an associative array with the table as key and the