WorkspaceVersionRecordsCommand extends Command

Fetches all versions in the database, and checks for integrity

Internal
Attributes
#[AsCommand]
'cleanup:versions'
'Find all versioned records and possibly cleans up invalid records in the database.'

Table of Contents

Properties

$allWorkspaces  : array<string|int, mixed>
List of all workspaces
$foundRecords  : array<string|int, mixed>
Array with all records found when traversing the database

Methods

__construct()  : mixed
configure()  : mixed
Configuring the command options
deleteRecords()  : mixed
Deletes records via DataHandler
execute()  : int
Executes the command to find versioned records
getAllVersionableTables()  : array<string|int, mixed>
Returns all TCA tables where workspaces is enabled
loadAllWorkspaceRecords()  : array<string|int, mixed>
Fetches all sys_workspace records from the database
resetRecordsWithoutValidWorkspace()  : mixed
Set the workspace ID to "0" (= live) for records that have a workspace not found in the system (e.g. hard deleted in the database)
traversePageTreeForVersionedRecords()  : mixed
Recursive traversal of page tree, fetching ALL versioned records found in the database

Properties

$allWorkspaces

List of all workspaces

protected array<string|int, mixed> $allWorkspaces = [0 => 'Live Workspace']

$foundRecords

Array with all records found when traversing the database

protected array<string|int, mixed> $foundRecords = [ // All versions of records found // Subset of "all" which are offline versions (t3ver_oid > 0) [Informational] 'all_versioned_records' => [], // All records that has been published and can therefore be removed permanently // Subset of "versions" that is a count of 1 or more (has been published) [Informational] 'published_versions' => [], // All versions that are offline versions in the Live workspace. You may wish to flush these if you only use // workspaces for versioning since then you might find lots of versions piling up in the live workspace which // have simply been disconnected from the workspace before they were published. 'versions_in_live' => [], // Versions that has lost their connection to a workspace in TYPO3. // Subset of "versions" that doesn't belong to an existing workspace [Warning: Fix by move to live workspace] 'invalid_workspace' => [], ]

Methods

configure()

Configuring the command options

public configure() : mixed

deleteRecords()

Deletes records via DataHandler

protected deleteRecords(array<string|int, mixed> $records, bool $dryRun, SymfonyStyle $io) : mixed
Parameters
$records : 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 versioned records

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

getAllVersionableTables()

Returns all TCA tables where workspaces is enabled

protected getAllVersionableTables() : array<string|int, mixed>
Return values
array<string|int, mixed>

loadAllWorkspaceRecords()

Fetches all sys_workspace records from the database

protected loadAllWorkspaceRecords() : array<string|int, mixed>
Return values
array<string|int, mixed>

all workspaces with UID as key, and the title as value

resetRecordsWithoutValidWorkspace()

Set the workspace ID to "0" (= live) for records that have a workspace not found in the system (e.g. hard deleted in the database)

protected resetRecordsWithoutValidWorkspace(array<string|int, mixed> $records, bool $dryRun, SymfonyStyle $io) : mixed
Parameters
$records : array<string|int, mixed>

array with array of table and uid of each record

$dryRun : bool

check if the records should NOT be deleted (use --dry-run to avoid)

$io : SymfonyStyle

traversePageTreeForVersionedRecords()

Recursive traversal of page tree, fetching ALL versioned records found in the database

protected traversePageTreeForVersionedRecords(int $rootID, int $depth[, bool $isInsideVersionedPage = false ][, bool $rootIsVersion = false ]) : mixed
Parameters
$rootID : int

Page root id (must be online, valid page record - or zero for page tree root)

$depth : int

Depth

$isInsideVersionedPage : bool = false

DON'T set from outside, internal. (indicates we are inside a version of a page)

$rootIsVersion : bool = false

DON'T set from outside, internal. Indicates that rootID is a version of a page


        
On this page

Search results