OrphanRecordsCommand

class \TYPO3\CMS\Lowlevel\Command\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
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 $orphanedRecords, bool $dryRun, SymfonyStyle $io) : void

Parameters

$orphanedRecords : array

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 $allRecords = [] ]) : array

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 = []

the records that are already marked as deleted (used when going recursive)

Return values

array —

the modified $deletedRecords array

On this page