WorkspaceService implements SingletonInterface

Internal
Attributes
#[Autoconfigure]
$public: true

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Constants

LIVE_WORKSPACE_ID  = 0
PUBLISH_ACCESS_HIDE_ENTIRE_WORKSPACE_ACTION_DROPDOWN  = 4
PUBLISH_ACCESS_ONLY_IN_PUBLISH_STAGE  = 1
PUBLISH_ACCESS_ONLY_WORKSPACE_OWNERS  = 2
TABLE_WORKSPACE  = 'sys_workspace'

Properties

$pagesWithVersionsInTable  : array<string|int, mixed>
$versionsOnPageCache  : array<string|int, mixed>

Methods

getAvailableWorkspaces()  : array<string|int, mixed>
Retrieves the available workspaces from the database and checks whether they're available to the current BE user
getCmdArrayForFlushWS()  : array<string|int, mixed>
Building DataHandler CMD-array for releasing all versions in a workspace.
getCmdArrayForPublishWS()  : array<string|int, mixed>
Building DataHandler CMD-array for publishing all versions in a workspace.
getCurrentWorkspace()  : int
Gets the current workspace ID.
getPagesWithVersionsInTable()  : array<string|int, mixed>
Gets all pages that have workspace versions per table.
getPreviewLinkLifetime()  : int
easy function to just return the number of hours.
getWorkspaceTitle()  : string
Find the title for the requested workspace.
hasPageRecordVersions()  : bool
Determines whether a page has workspace versions.
isNewPage()  : bool
Determine whether a specific page is new and not yet available in the LIVE workspace
selectVersionsInWorkspace()  : array<string|int, mixed>
Select all records from workspace pending for publishing Used from backend to display workspace overview User for auto-publishing for selecting versions for publication
fetchPagesWithVersionsInTable()  : array<string|int, mixed>
Gets all pages that have workspace versions in a particular table.
filterPermittedElements()  : array<string|int, mixed>
Remove all records which are not permitted for the user
getBackendUser()  : BackendUserAuthentication
getLanguageService()  : LanguageService
getMovedRecordsFromPages()  : array<string|int, mixed>
Find all moved records at their new position.
getNewVersionsForPages()  : array<string|int, mixed>
Find all versionized elements which are new (= do not have a live counterpart), so this method does not need to have a JOIN SQL statement.
getPageChildrenRecursive()  : array<string|int, int>
Recursively fetch all children of a given page
getTreeUids()  : string
Find all page uids recursive starting from a specific page
isLanguageAccessibleForCurrentUser()  : bool
Check current be users language access on given record.
isPageAccessibleForCurrentUser()  : bool
Checking access to the page the record is on, respecting ignored root level restrictions
selectAllVersionsFromPages()  : array<string|int, mixed>
Find all versionized elements except moved and new records.

Constants

LIVE_WORKSPACE_ID

public mixed LIVE_WORKSPACE_ID = 0

PUBLISH_ACCESS_HIDE_ENTIRE_WORKSPACE_ACTION_DROPDOWN

public mixed PUBLISH_ACCESS_HIDE_ENTIRE_WORKSPACE_ACTION_DROPDOWN = 4

PUBLISH_ACCESS_ONLY_IN_PUBLISH_STAGE

public mixed PUBLISH_ACCESS_ONLY_IN_PUBLISH_STAGE = 1

PUBLISH_ACCESS_ONLY_WORKSPACE_OWNERS

public mixed PUBLISH_ACCESS_ONLY_WORKSPACE_OWNERS = 2

TABLE_WORKSPACE

public mixed TABLE_WORKSPACE = 'sys_workspace'

Properties

$pagesWithVersionsInTable

protected array<string|int, mixed> $pagesWithVersionsInTable = []

$versionsOnPageCache

protected array<string|int, mixed> $versionsOnPageCache = []

Methods

getAvailableWorkspaces()

Retrieves the available workspaces from the database and checks whether they're available to the current BE user

public getAvailableWorkspaces() : array<string|int, mixed>
Return values
array<string|int, mixed>

array of workspaces available to the current user

getCmdArrayForFlushWS()

Building DataHandler CMD-array for releasing all versions in a workspace.

public getCmdArrayForFlushWS(int $wsid[, int|null $language = null ]) : array<string|int, mixed>
Parameters
$wsid : int

Real workspace ID, cannot be ONLINE (zero).

$language : int|null = null

Select specific language only

Return values
array<string|int, mixed>

Command array for DataHandler

getCmdArrayForPublishWS()

Building DataHandler CMD-array for publishing all versions in a workspace.

public getCmdArrayForPublishWS(int $wsid[, bool $_ = false ][, int|null $language = null ]) : array<string|int, mixed>
Parameters
$wsid : int

Real workspace ID, cannot be ONLINE (zero).

$_ : bool = false

Dummy parameter, only there because testing framework is calling it with 2 parameters

$language : int|null = null

Select specific language only

Return values
array<string|int, mixed>

Command array for DataHandler

getCurrentWorkspace()

Gets the current workspace ID.

public getCurrentWorkspace() : int
Return values
int

getPagesWithVersionsInTable()

Gets all pages that have workspace versions per table.

public getPagesWithVersionsInTable(int $workspaceId) : array<string|int, mixed>

Result: [ 'sys_template' => [], 'tt_content' => [ 1 => true, 11 => true, 13 => true, 15 => true ], 'tx_something => [ 15 => true, 11 => true, 21 => true ], ]

Parameters
$workspaceId : int
Return values
array<string|int, mixed>

getPreviewLinkLifetime()

easy function to just return the number of hours.

public getPreviewLinkLifetime() : int

a preview link is valid, based on the workspaces' custom value (default to 48 hours) or falls back to the users' TSconfig value "options.workspaces.previewLinkTTLHours".

by default, it's 48hs.

Return values
int

The hours as a number

getWorkspaceTitle()

Find the title for the requested workspace.

public getWorkspaceTitle(int $wsId) : string
Parameters
$wsId : int
Return values
string

hasPageRecordVersions()

Determines whether a page has workspace versions.

public hasPageRecordVersions(int $workspaceId, int $pageId) : bool
Parameters
$workspaceId : int
$pageId : int
Return values
bool

isNewPage()

Determine whether a specific page is new and not yet available in the LIVE workspace

public isNewPage(int $id[, int $language = 0 ]) : bool
Parameters
$id : int

Primary key of the page to check

$language : int = 0

Language for which to check the page

Return values
bool

selectVersionsInWorkspace()

Select all records from workspace pending for publishing Used from backend to display workspace overview User for auto-publishing for selecting versions for publication

public selectVersionsInWorkspace(int $wsid[, int $stage = -99 ][, int $pageId = -1 ][, int $recursionLevel = 0 ][, string $selectionType = 'tables_select' ][, int $language = null ]) : array<string|int, mixed>
Parameters
$wsid : int

Workspace ID. If -99, will select ALL versions from ANY workspace. If -98 will select all but ONLINE. >=-1 will select from the actual workspace

$stage : int = -99

Stage filter: -99 means no filtering, otherwise it will be used to select only elements with that stage. For publishing, that would be "10

$pageId : int = -1

Page id: Live page for which to find versions in workspace!

$recursionLevel : int = 0

Recursion Level - select versions recursive - parameter is only relevant if $pageId != -1

$selectionType : string = 'tables_select'

How to collect records for "listing" or "modify" these tables. Support the permissions of each type of record, see \TYPO3\CMS\Core\Authentication\BackendUserAuthentication::check.

$language : int = null

Select specific language only

Return values
array<string|int, mixed>

Array of all records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oidfields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid

fetchPagesWithVersionsInTable()

Gets all pages that have workspace versions in a particular table.

protected fetchPagesWithVersionsInTable(int $workspaceId, string $tableName) : array<string|int, mixed>

Result: [ 1 => true, 11 => true, 13 => true, 15 => true ],

Parameters
$workspaceId : int
$tableName : string
Return values
array<string|int, mixed>

filterPermittedElements()

Remove all records which are not permitted for the user

protected filterPermittedElements(array<string|int, mixed> $recs, string $table) : array<string|int, mixed>
Parameters
$recs : array<string|int, mixed>
$table : string
Return values
array<string|int, mixed>

getMovedRecordsFromPages()

Find all moved records at their new position.

protected getMovedRecordsFromPages(string $table, string $pageList, int $wsid, int $stage) : array<string|int, mixed>
Parameters
$table : string
$pageList : string
$wsid : int
$stage : int
Return values
array<string|int, mixed>

getNewVersionsForPages()

Find all versionized elements which are new (= do not have a live counterpart), so this method does not need to have a JOIN SQL statement.

protected getNewVersionsForPages(string $table, string $pageList, int $wsid, int $stage, int|null $language) : array<string|int, mixed>
Parameters
$table : string
$pageList : string
$wsid : int
$stage : int
$language : int|null
Return values
array<string|int, mixed>

getPageChildrenRecursive()

Recursively fetch all children of a given page

protected getPageChildrenRecursive(int $pid, int $depth, int $begin, string $permsClause) : array<string|int, int>
Parameters
$pid : int

uid of the page

$depth : int
$begin : int
$permsClause : string
Return values
array<string|int, int>

List of child row $uid's

getTreeUids()

Find all page uids recursive starting from a specific page

protected getTreeUids(int $pageId, int $wsid, int $recursionLevel) : string
Parameters
$pageId : int
$wsid : int
$recursionLevel : int
Return values
string

Comma sep. uid list

isLanguageAccessibleForCurrentUser()

Check current be users language access on given record.

protected isLanguageAccessibleForCurrentUser(string $table, array<string|int, mixed> $record) : bool
Parameters
$table : string

Name of the table

$record : array<string|int, mixed>

Record row to be checked

Return values
bool

isPageAccessibleForCurrentUser()

Checking access to the page the record is on, respecting ignored root level restrictions

protected isPageAccessibleForCurrentUser(string $table, array<string|int, mixed> $record) : bool
Parameters
$table : string

Name of the table

$record : array<string|int, mixed>

Record row to be checked

Return values
bool

selectAllVersionsFromPages()

Find all versionized elements except moved and new records.

protected selectAllVersionsFromPages(string $table, string $pageList, int $wsid, int $stage[, int|null $language = null ]) : array<string|int, mixed>
Parameters
$table : string
$pageList : string
$wsid : int
$stage : int
$language : int|null = null
Return values
array<string|int, mixed>

        
On this page

Search results