‪TYPO3CMS  ‪main
TYPO3\CMS\Workspaces\Service\WorkspaceService Class Reference
Inheritance diagram for TYPO3\CMS\Workspaces\Service\WorkspaceService:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

array getAvailableWorkspaces ()
 
 getCurrentWorkspace ()
 
int getPreviewLinkLifetime ()
 
 getWorkspaceTitle (int $wsId)
 
array getCmdArrayForPublishWS (int $wsid, bool $_=false, int $language=null)
 
array getCmdArrayForFlushWS (int $wsid, int $language=null)
 
array selectVersionsInWorkspace (int $wsid, int $stage=-99, int $pageId=-1, int $recursionLevel=0, string $selectionType='tables_select', int $language=null)
 
 isNewPage (int $id, int $language=0)
 
bool hasPageRecordVersions (int $workspaceId, int $pageId)
 
 getPagesWithVersionsInTable (int $workspaceId)
 

Public Attributes

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

Protected Member Functions

 selectAllVersionsFromPages (string $table, string $pageList, int $wsid, int $stage, int $language=null)
 
 getNewVersionsForPages (string $table, string $pageList, int $wsid, int $stage, ?int $language)
 
 getMovedRecordsFromPages (string $table, string $pageList, int $wsid, int $stage)
 
string getTreeUids (int $pageId, int $wsid, int $recursionLevel)
 
int[] getPageChildrenRecursive (int $pid, int $depth, int $begin, string $permsClause)
 
 filterPermittedElements (array $recs, string $table)
 
 isPageAccessibleForCurrentUser (string $table, array $record)
 
 isLanguageAccessibleForCurrentUser (string $table, array $record)
 
 fetchPagesWithVersionsInTable (int $workspaceId, string $tableName)
 
 getLanguageService ()
 
 getBackendUser ()
 

Protected Attributes

array $versionsOnPageCache = []
 
array $pagesWithVersionsInTable = []
 

Detailed Description

Definition at line 37 of file WorkspaceService.php.

Member Function Documentation

◆ fetchPagesWithVersionsInTable()

TYPO3\CMS\Workspaces\Service\WorkspaceService::fetchPagesWithVersionsInTable ( int  $workspaceId,
string  $tableName 
)
protected

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

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

Definition at line 930 of file WorkspaceService.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\getPagesWithVersionsInTable(), and TYPO3\CMS\Workspaces\Service\WorkspaceService\hasPageRecordVersions().

◆ filterPermittedElements()

TYPO3\CMS\Workspaces\Service\WorkspaceService::filterPermittedElements ( array  $recs,
string  $table 
)
protected

◆ getAvailableWorkspaces()

array TYPO3\CMS\Workspaces\Service\WorkspaceService::getAvailableWorkspaces ( )

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

Returns
‪array array of workspaces available to the current user

Definition at line 55 of file WorkspaceService.php.

References TYPO3\CMS\Workspaces\Service\WorkspaceService\getBackendUser(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getWorkspaceTitle(), and TYPO3\CMS\Workspaces\Service\WorkspaceService\LIVE_WORKSPACE_ID.

◆ getBackendUser()

◆ getCmdArrayForFlushWS()

array TYPO3\CMS\Workspaces\Service\WorkspaceService::getCmdArrayForFlushWS ( int  $wsid,
int  $language = null 
)

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

Parameters
int$wsid‪Real workspace ID, cannot be ONLINE (zero).
int | null$language‪Select specific language only
Returns
‪array Command array for DataHandler

Definition at line 182 of file WorkspaceService.php.

References TYPO3\CMS\Workspaces\Service\WorkspaceService\selectVersionsInWorkspace().

◆ getCmdArrayForPublishWS()

array TYPO3\CMS\Workspaces\Service\WorkspaceService::getCmdArrayForPublishWS ( int  $wsid,
bool  $_ = false,
int  $language = null 
)

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

Parameters
int$wsid‪Real workspace ID, cannot be ONLINE (zero).
bool$_‪Dummy parameter, only there because testing framework is calling it with 2 parameters
int | null$language‪Select specific language only
Returns
‪array Command array for DataHandler

Definition at line 144 of file WorkspaceService.php.

References TYPO3\CMS\Workspaces\Service\WorkspaceService\selectVersionsInWorkspace(), and TYPO3\CMS\Workspaces\Service\StagesService\STAGE_PUBLISH_ID.

◆ getCurrentWorkspace()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getCurrentWorkspace ( )

◆ getLanguageService()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getLanguageService ( )
protected

◆ getMovedRecordsFromPages()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getMovedRecordsFromPages ( string  $table,
string  $pageList,
int  $wsid,
int  $stage 
)
protected

◆ getNewVersionsForPages()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getNewVersionsForPages ( string  $table,
string  $pageList,
int  $wsid,
int  $stage,
?int  $language 
)
protected

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.

Definition at line 393 of file WorkspaceService.php.

References $fields, $GLOBALS, TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Database\Connection\PARAM_INT_ARRAY.

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\selectVersionsInWorkspace().

◆ getPageChildrenRecursive()

int [] TYPO3\CMS\Workspaces\Service\WorkspaceService::getPageChildrenRecursive ( int  $pid,
int  $depth,
int  $begin,
string  $permsClause 
)
protected

Recursively fetch all children of a given page

Parameters
int$pid‪uid of the page
Returns
‪int[] List of child row $uid's

Definition at line 726 of file WorkspaceService.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\getTreeUids().

◆ getPagesWithVersionsInTable()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getPagesWithVersionsInTable ( int  $workspaceId)

Gets all pages that have workspace versions per table.

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

Definition at line 906 of file WorkspaceService.php.

References $GLOBALS, and TYPO3\CMS\Workspaces\Service\WorkspaceService\fetchPagesWithVersionsInTable().

◆ getPreviewLinkLifetime()

int TYPO3\CMS\Workspaces\Service\WorkspaceService::getPreviewLinkLifetime ( )

easy function to just return the number of hours.

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.

Returns
‪int The hours as a number

Definition at line 100 of file WorkspaceService.php.

References TYPO3\CMS\Workspaces\Service\WorkspaceService\getBackendUser(), and TYPO3\CMS\Workspaces\Service\WorkspaceService\getCurrentWorkspace().

Referenced by TYPO3\CMS\Workspaces\Preview\PreviewUriBuilder\__construct().

◆ getTreeUids()

◆ getWorkspaceTitle()

TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle ( int  $wsId)

◆ hasPageRecordVersions()

bool TYPO3\CMS\Workspaces\Service\WorkspaceService::hasPageRecordVersions ( int  $workspaceId,
int  $pageId 
)

Determines whether a page has workspace versions.

Parameters
int$workspaceId
int$pageId
Returns
‪bool

Definition at line 859 of file WorkspaceService.php.

References $GLOBALS, and TYPO3\CMS\Workspaces\Service\WorkspaceService\fetchPagesWithVersionsInTable().

◆ isLanguageAccessibleForCurrentUser()

TYPO3\CMS\Workspaces\Service\WorkspaceService::isLanguageAccessibleForCurrentUser ( string  $table,
array  $record 
)
protected

Check current be users language access on given record.

Parameters
string$table‪Name of the table
array$record‪Record row to be checked

Definition at line 794 of file WorkspaceService.php.

References $GLOBALS, TYPO3\CMS\Webhooks\Message\$record, and TYPO3\CMS\Workspaces\Service\WorkspaceService\getBackendUser().

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\filterPermittedElements().

◆ isNewPage()

TYPO3\CMS\Workspaces\Service\WorkspaceService::isNewPage ( int  $id,
int  $language = 0 
)

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

Parameters
int$id‪Primary key of the page to check
int$language‪Language for which to check the page

Definition at line 810 of file WorkspaceService.php.

References $GLOBALS, and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ isPageAccessibleForCurrentUser()

TYPO3\CMS\Workspaces\Service\WorkspaceService::isPageAccessibleForCurrentUser ( string  $table,
array  $record 
)
protected

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

Parameters
string$table‪Name of the table
array$record‪Record row to be checked

Definition at line 773 of file WorkspaceService.php.

References TYPO3\CMS\Webhooks\Message\$record, TYPO3\CMS\Workspaces\Service\WorkspaceService\getBackendUser(), and TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW.

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\filterPermittedElements().

◆ selectAllVersionsFromPages()

TYPO3\CMS\Workspaces\Service\WorkspaceService::selectAllVersionsFromPages ( string  $table,
string  $pageList,
int  $wsid,
int  $stage,
int  $language = null 
)
protected

◆ selectVersionsInWorkspace()

array TYPO3\CMS\Workspaces\Service\WorkspaceService::selectVersionsInWorkspace ( int  $wsid,
int  $stage = -99,
int  $pageId = -1,
int  $recursionLevel = 0,
string  $selectionType = 'tables_select',
int  $language = null 
)

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

Parameters
int$wsid‪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
int$stage‪Stage filter: -99 means no filtering, otherwise it will be used to select only elements with that stage. For publishing, that would be "10
int$pageId‪Page id: Live page for which to find versions in workspace!
int$recursionLevel‪Recursion Level - select versions recursive - parameter is only relevant if $pageId != -1
string$selectionType‪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.
int$language‪Select specific language only
Returns
‪array 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

Definition at line 220 of file WorkspaceService.php.

References $GLOBALS, $output, TYPO3\CMS\Workspaces\Service\WorkspaceService\filterPermittedElements(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getBackendUser(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getMovedRecordsFromPages(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getNewVersionsForPages(), TYPO3\CMS\Workspaces\Service\WorkspaceService\getTreeUids(), and TYPO3\CMS\Workspaces\Service\WorkspaceService\selectAllVersionsFromPages().

Referenced by TYPO3\CMS\Workspaces\Service\WorkspaceService\getCmdArrayForFlushWS(), and TYPO3\CMS\Workspaces\Service\WorkspaceService\getCmdArrayForPublishWS().

Member Data Documentation

◆ $pagesWithVersionsInTable

array TYPO3\CMS\Workspaces\Service\WorkspaceService::$pagesWithVersionsInTable = []
protected

Definition at line 40 of file WorkspaceService.php.

◆ $versionsOnPageCache

array TYPO3\CMS\Workspaces\Service\WorkspaceService::$versionsOnPageCache = []
protected

Definition at line 39 of file WorkspaceService.php.

◆ LIVE_WORKSPACE_ID

◆ PUBLISH_ACCESS_HIDE_ENTIRE_WORKSPACE_ACTION_DROPDOWN

const TYPO3\CMS\Workspaces\Service\WorkspaceService::PUBLISH_ACCESS_HIDE_ENTIRE_WORKSPACE_ACTION_DROPDOWN = 4

◆ PUBLISH_ACCESS_ONLY_IN_PUBLISH_STAGE

◆ PUBLISH_ACCESS_ONLY_WORKSPACE_OWNERS

const TYPO3\CMS\Workspaces\Service\WorkspaceService::PUBLISH_ACCESS_ONLY_WORKSPACE_OWNERS = 2

◆ TABLE_WORKSPACE

const TYPO3\CMS\Workspaces\Service\WorkspaceService::TABLE_WORKSPACE = 'sys_workspace'