OrphanRecordsCommand extends Command

Finds (and fixes) all records that have an invalid / deleted page ID

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 records not attached to the pagetree and permanently delete these records
findAllConnectedRecordsInPage()  : 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.

Methods

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> $orphanedRecords, bool $dryRun, SymfonyStyle $io) : void
Parameters
$orphanedRecords : 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 records not attached to the pagetree and permanently delete these records

protected execute(InputInterface $input, OutputInterface $output) : int
Parameters
$input : InputInterface
$output : OutputInterface
Return values
int

findAllConnectedRecordsInPage()

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 findAllConnectedRecordsInPage(int $pageId, int $depth[, array<string|int, mixed> $allRecords = [] ]) : 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

$allRecords : 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


        
On this page

Search results