WorkspaceVersionRecordsCommand

class \TYPO3\CMS\Workspaces\Command\WorkspaceVersionRecordsCommand

Extends
Command

Fetches all versions in the database, and checks for integrity

Attributes

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

Table of Contents

Properties

$allWorkspaces  : array
List of all workspaces
$foundRecords  : array
Array with all records found when traversing the database

Methods

__construct()  : mixed
configure()  : void
Configuring the command options
deleteRecords()  : mixed
Deletes records via DataHandler
execute()  : int
Executes the command to find versioned records
getAllVersionableTables()  : TcaSchema[]
Returns all TCA tables where workspaces is enabled
loadAllWorkspaceRecords()  : array
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 $allWorkspaces = [0 => 'Live Workspace']

$foundRecords

Array with all records found when traversing the database

protected array $foundRecords = [ // All versions of records found // Subset of "all…
Show the full value[ // 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

protected configure() : void

deleteRecords()

Deletes records via DataHandler

protected deleteRecords(array $records, bool $dryRun, SymfonyStyle $io) : mixed

Parameters

$records : 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 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() : TcaSchema[]

Return values

TcaSchema[]

loadAllWorkspaceRecords()

Fetches all sys_workspace records from the database

protected loadAllWorkspaceRecords() : array

Return values

array —

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 $records, bool $dryRun, SymfonyStyle $io) : mixed

Parameters

$records : array

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