2 namespace TYPO3\CMS\Frontend\Page;
18 use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
39 public $urltypes = array(
'',
'http://',
'ftp://',
'mailto:',
'https://');
146 '_PAGES_OVERLAY_UID',
147 '_PAGES_OVERLAY_LANGUAGE',
180 public function init($show_hidden)
182 $this->where_groupAccess =
'';
184 if ($this->versioningPreview) {
189 $this->where_hid_del =
' AND pages.deleted=0 AND (pages.t3ver_wsid=0 OR pages.t3ver_wsid=' . (int)$this->versioningWorkspaceId .
')';
194 $this->where_hid_del = $this->
enableFields(
'pages', $show_hidden, array(
'fe_group' =>
true),
true);
196 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][PageRepository::class][
'init'])) {
197 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][PageRepository::class][
'init'] as $classRef) {
200 throw new \UnexpectedValueException($hookObject .
' must implement interface TYPO3\\CMS\\Frontend\\Page\\PageRepositoryInitHookInterface', 1379579812);
202 $hookObject->init_postProcess($this);
224 public function getPage($uid, $disableGroupAccessCheck =
false)
227 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'getPage'])) {
228 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'getPage'] as $classRef) {
231 throw new \UnexpectedValueException(
'$hookObject must implement interface ' . PageRepositoryGetPageHookInterface::class, 1251476766);
233 $hookObject->getPage_preProcess($uid, $disableGroupAccessCheck, $this);
237 $cacheKey = md5($accessCheck .
'-' . $this->where_hid_del .
'-' . $this->sys_language_uid);
238 if (is_array($this->cache_getPage[$uid][$cacheKey])) {
239 return $this->cache_getPage[$uid][$cacheKey];
242 $row = $this->
getDatabaseConnection()->exec_SELECTgetSingleRow(
'*',
'pages',
'uid=' . (
int)$uid . $this->where_hid_del . $accessCheck);
244 $this->versionOL(
'pages', $row);
245 if (is_array($row)) {
249 $this->cache_getPage[$uid][$cacheKey] = $result;
263 if ($this->cache_getPage_noCheck[$uid]) {
264 return $this->cache_getPage_noCheck[$uid];
271 $this->versionOL(
'pages', $row);
272 if (is_array($row)) {
276 $this->cache_getPage_noCheck[$uid] = $result;
290 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'*',
'pages',
'pid=' . (
int)$uid . $this->where_hid_del . $this->where_groupAccess,
'',
'sorting',
'1');
294 $this->versionOL(
'pages', $row);
295 if (is_array($row)) {
311 $alias = strtolower($alias);
312 if ($this->cache_getPageIdFromAlias[$alias]) {
313 return $this->cache_getPageIdFromAlias[$alias];
316 $row = $db->exec_SELECTgetSingleRow(
'uid',
'pages',
'alias=' . $db->fullQuoteStr($alias,
'pages') .
' AND pid>=0 AND pages.deleted=0');
319 $this->cache_getPageIdFromAlias[$alias] = $row[
'uid'];
322 $this->cache_getPageIdFromAlias[$alias] = 0;
338 return isset($rows[0]) ? $rows[0] : array();
354 if (empty($pagesInput)) {
362 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'getPageOverlay'])) {
363 foreach ($pagesInput as $origPage) {
364 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'getPageOverlay'] as $classRef) {
367 throw new \UnexpectedValueException(
'$hookObject must implement interface ' . PageRepositoryGetPageOverlayHookInterface::class, 1269878881);
369 $hookObject->getPageOverlay_preProcess($origPage, $lUid, $this);
378 $origPage = reset($pagesInput);
379 if (is_array($origPage)) {
381 $fieldArr = array_intersect($fieldArr, array_keys($origPage));
383 foreach ($pagesInput as $origPage) {
384 if (is_array($origPage)) {
386 $page_ids[] = $origPage[
'uid'];
389 $page_ids[] = $origPage;
392 if (!empty($fieldArr)) {
393 if (!in_array(
'pid', $fieldArr,
true)) {
404 $res = $db->exec_SELECTquery(
405 implode(
',', $fieldArr),
406 'pages_language_overlay',
407 'pid IN(' . implode(
',', $db->cleanIntArray($page_ids)) .
')'
408 .
' AND sys_language_uid=' . (
int)$lUid . $this->
enableFields(
'pages_language_overlay')
411 while ($row = $db->sql_fetch_assoc($res)) {
412 $this->versionOL(
'pages_language_overlay', $row);
413 if (is_array($row)) {
414 $row[
'_PAGES_OVERLAY'] =
true;
415 $row[
'_PAGES_OVERLAY_UID'] = $row[
'uid'];
416 $row[
'_PAGES_OVERLAY_LANGUAGE'] = $lUid;
417 $origUid = $row[
'pid'];
421 $overlays[$origUid] = $row;
424 $db->sql_free_result($res);
428 $pagesOutput = array();
429 foreach ($pagesInput as $key => $origPage) {
430 if (is_array($origPage)) {
431 $pagesOutput[$key] = $origPage;
432 if (isset($overlays[$origPage[
'uid']])) {
434 foreach ($overlays[$origPage[
'uid']] as $fieldName => $fieldValue) {
435 if ($fieldName !==
'uid' && $fieldName !==
'pid') {
437 $pagesOutput[$key][$fieldName] = $fieldValue;
443 if (isset($overlays[$origPage])) {
444 $pagesOutput[$key] = $overlays[$origPage];
464 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'getRecordOverlay'])) {
465 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'getRecordOverlay'] as $classRef) {
468 throw new \UnexpectedValueException(
'$hookObject must implement interface ' . PageRepositoryGetRecordOverlayHookInterface::class, 1269881658);
470 $hookObject->getRecordOverlay_preProcess($table, $row, $sys_language_content, $OLmode, $this);
473 if ($row[
'uid'] > 0 && ($row[
'pid'] > 0 || in_array($table, $this->tableNamesAllowedOnRootLevel,
true))) {
474 if (
$GLOBALS[
'TCA'][$table] &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField'] &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerField']) {
475 if (!
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerTable']) {
482 if ($sys_language_content > 0) {
484 if ((
int)$row[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']] === 0) {
486 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'*', $table,
'pid=' . (
int)$row[
'pid'] .
' AND ' .
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField'] .
'=' . (
int)$sys_language_content .
' AND ' .
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerField'] .
'=' . (
int)$row[
'uid'] . $this->
enableFields($table),
'',
'',
'1');
489 $this->versionOL($table, $olrow);
491 if (is_array($olrow)) {
492 if (isset($olrow[
'_ORIG_uid'])) {
493 $row[
'_ORIG_uid'] = $olrow[
'_ORIG_uid'];
495 if (isset($olrow[
'_ORIG_pid'])) {
496 $row[
'_ORIG_pid'] = $olrow[
'_ORIG_pid'];
498 foreach ($row as $fN => $fV) {
499 if ($fN !==
'uid' && $fN !==
'pid' && isset($olrow[$fN])) {
501 $row[$fN] = $olrow[$fN];
503 }
elseif ($fN ===
'uid') {
504 $row[
'_LOCALIZED_UID'] = $olrow[
'uid'];
507 }
elseif ($OLmode ===
'hideNonTranslated' && (
int)$row[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']] === 0) {
512 }
elseif ($sys_language_content != $row[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']]) {
518 if ($row[
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']] > 0) {
525 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'getRecordOverlay'])) {
526 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'getRecordOverlay'] as $classRef) {
529 throw new \UnexpectedValueException(
'$hookObject must implement interface ' . PageRepositoryGetRecordOverlayHookInterface::class, 1269881659);
531 $hookObject->getRecordOverlay_postProcess($table, $row, $sys_language_content, $OLmode, $this);
559 public function getMenu($pageId, $fields =
'*', $sortField =
'sorting', $additionalWhereClause =
'', $checkShortcuts =
true)
561 return $this->
getSubpagesForPages((array)$pageId, $fields, $sortField, $additionalWhereClause, $checkShortcuts);
577 public function getMenuForPages(array $pageIds, $fields =
'*', $sortField =
'sorting', $additionalWhereClause =
'', $checkShortcuts =
true)
579 return $this->
getSubpagesForPages($pageIds, $fields, $sortField, $additionalWhereClause, $checkShortcuts,
false);
601 protected function getSubpagesForPages(array $pageIds, $fields =
'*', $sortField =
'sorting', $additionalWhereClause =
'', $checkShortcuts =
true, $parentPages =
true)
604 $relationField = $parentPages ?
'pid' :
'uid';
607 $whereStatement = $relationField .
' IN ('
608 . implode(
',', $db->cleanIntArray($pageIds)) .
')'
609 . $this->where_hid_del
610 . $this->where_groupAccess
612 . $additionalWhereClause;
614 $databaseResource = $db->exec_SELECTquery(
622 while (($page = $db->sql_fetch_assoc($databaseResource))) {
623 $originalUid = $page[
'uid'];
626 $this->versionOL(
'pages', $page,
true);
632 if ($checkShortcuts) {
638 $pages[$originalUid] = $page;
642 $db->sql_free_result($databaseResource);
664 if (is_array($mountPointInfo) && $mountPointInfo[
'overlay']) {
668 $mountPointPage = $this->
getPage($mountPointInfo[
'mount_pid']);
670 if (!empty($mountPointPage)) {
671 $page = $mountPointPage;
672 $page[
'_MP_PARAM'] = $mountPointInfo[
'MPvar'];
693 $dokType = (int)$page[
'doktype'];
694 $shortcutMode = (int)$page[
'shortcut_mode'];
696 if ($dokType === self::DOKTYPE_SHORTCUT && ($page[
'shortcut'] || $shortcutMode)) {
697 if ($shortcutMode === self::SHORTCUT_MODE_NONE) {
699 $searchField =
'uid';
700 $searchUid = (int)$page[
'shortcut'];
701 }
elseif ($shortcutMode === self::SHORTCUT_MODE_FIRST_SUBPAGE || $shortcutMode === self::SHORTCUT_MODE_RANDOM_SUBPAGE) {
703 $searchField =
'pid';
706 $searchUid = (int)$page[
'shortcut'] ?: $page[
'uid'];
707 }
elseif ($shortcutMode === self::SHORTCUT_MODE_PARENT_PAGE) {
709 $searchField =
'uid';
710 $searchUid = $page[
'pid'];
716 $whereStatement = $searchField .
'=' . $searchUid
717 . $this->where_hid_del
718 . $this->where_groupAccess
719 .
' ' . $additionalWhereClause;
730 }
elseif ($dokType === self::DOKTYPE_SHORTCUT) {
749 $domain = explode(
':', $domain);
750 $domain = strtolower(preg_replace(
'/\\.$/',
'', $domain[0]));
752 $path = trim(preg_replace(
'/\\/[^\\/]*$/',
'', $path));
755 $domain = preg_replace(
'/\\/*$/',
'', $domain);
756 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'pages.uid,sys_domain.redirectTo,sys_domain.redirectHttpStatusCode,sys_domain.prepend_params',
'pages,sys_domain',
'pages.uid=sys_domain.pid
757 AND sys_domain.hidden=0
758 AND (sys_domain.domainName=' . $this->
getDatabaseConnection()->fullQuoteStr($domain,
'sys_domain') .
' OR sys_domain.domainName=' . $this->
getDatabaseConnection()->fullQuoteStr(($domain .
'/'),
'sys_domain') .
') ' . $this->where_hid_del . $this->where_groupAccess,
'',
'', 1);
762 if ($row[
'redirectTo']) {
763 $redirectUrl = $row[
'redirectTo'];
764 if ($row[
'prepend_params']) {
765 $redirectUrl = rtrim($redirectUrl,
'/');
766 $prependStr = ltrim(substr($request_uri, strlen($path)),
'/');
767 $redirectUrl .=
'/' . $prependStr;
769 $statusCode = (int)$row[
'redirectHttpStatusCode'];
770 if ($statusCode && defined(HttpUtility::class .
'::HTTP_STATUS_' . $statusCode)) {
803 public function getRootLine($uid, $MP =
'', $ignoreMPerrors =
false)
807 return $rootline->get();
808 }
catch (\RuntimeException $ex) {
809 if ($ignoreMPerrors) {
810 $this->error_getRootLine = $ex->getMessage();
811 if (substr($this->error_getRootLine, -7) ===
'uid -1.') {
812 $this->error_getRootLine_failPid = -1;
816 }
elseif ($ex->getCode() === 1343589451) {
837 for ($a = 0; $a < $c; $a++) {
838 if ($rl[$a][
'uid']) {
857 if ($disable !==
false) {
858 GeneralUtility::deprecationLog(
'The disable option of PageRepository::getExtUrl() is deprecated since TYPO3 CMS 7, will be removed with TYPO3 CMS 8.');
861 if ((
int)$pagerow[
'doktype'] === self::DOKTYPE_LINK) {
862 $redirectTo = $this->urltypes[$pagerow[
'urltype']] . $pagerow[
'url'];
864 $uI = parse_url($redirectTo);
866 if (!$uI[
'scheme'] && $redirectTo[0] !==
'/') {
887 public function getMountPointInfo($pageId, $pageRec =
false, $prevMountPids = array(), $firstPageUid = 0)
890 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'enable_mount_pids']) {
891 if (isset($this->cache_getMountPointInfo[$pageId])) {
892 return $this->cache_getMountPointInfo[$pageId];
895 if (!is_array($pageRec)) {
896 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'uid,pid,doktype,mount_pid,mount_pid_ol,t3ver_state',
'pages',
'uid=' . (
int)$pageId .
' AND pages.deleted=0 AND pages.doktype<>255');
901 $this->versionOL(
'pages', $pageRec);
904 if (!$firstPageUid) {
905 $firstPageUid = $pageRec[
'uid'];
908 $mount_pid = (int)$pageRec[
'mount_pid'];
909 if (is_array($pageRec) && (int)$pageRec[
'doktype'] === self::DOKTYPE_MOUNTPOINT && $mount_pid > 0 && !in_array($mount_pid, $prevMountPids,
true)) {
911 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'uid,pid,doktype,mount_pid,mount_pid_ol,t3ver_state',
'pages',
'uid=' . $mount_pid .
' AND pages.deleted=0 AND pages.doktype<>255');
914 $this->versionOL(
'pages', $mountRec);
915 if (is_array($mountRec)) {
917 $prevMountPids[] = $mount_pid;
918 $recursiveMountPid = $this->
getMountPointInfo($mount_pid, $mountRec, $prevMountPids, $firstPageUid);
920 $result = $recursiveMountPid ?: array(
921 'mount_pid' => $mount_pid,
922 'overlay' => $pageRec[
'mount_pid_ol'],
923 'MPvar' => $mount_pid .
'-' . $firstPageUid,
924 'mount_point_rec' => $pageRec,
925 'mount_pid_rec' => $mountRec
933 $this->cache_getMountPointInfo[$pageId] = $result;
955 if (is_array(
$GLOBALS[
'TCA'][$table]) && $uid > 0) {
960 $this->versionOL($table, $row);
961 if (is_array($row)) {
990 public function getRawRecord($table, $uid, $fields =
'*', $noWSOL =
false)
993 if (isset(
$GLOBALS[
'TCA'][$table]) && is_array(
$GLOBALS[
'TCA'][$table]) && $uid > 0) {
999 $this->versionOL($table, $row);
1001 if (is_array($row)) {
1021 public function getRecordsByField($theTable, $theField, $theValue, $whereClause =
'', $groupBy =
'', $orderBy =
'', $limit =
'')
1023 if (is_array(
$GLOBALS[
'TCA'][$theTable])) {
1027 if (is_array($row)) {
1032 if (!empty($rows)) {
1056 public static function getHash($hash)
1058 $hashContent = null;
1061 $cacheEntry = $contentHashCache->get($hash);
1063 $hashContent = $cacheEntry;
1065 return $hashContent;
1082 public static function storeHash($hash, $data, $ident, $lifetime = 0)
1084 GeneralUtility::makeInstance(CacheManager::class)->getCache(
'cache_hash')->set($hash, $data, array(
'ident_' . $ident), (
int)$lifetime);
1097 return $GLOBALS[
'TCA'][$table][
'ctrl'][
'delete'] ?
' AND ' . $table .
'.' .
$GLOBALS[
'TCA'][$table][
'ctrl'][
'delete'] .
'=0' :
'';
1117 public function enableFields($table, $show_hidden = -1, $ignore_array = array(), $noVersionPreview =
false)
1124 if ($show_hidden === -1) {
1128 $ctrl =
$GLOBALS[
'TCA'][$table][
'ctrl'];
1130 if (is_array($ctrl)) {
1132 if ($ctrl[
'delete']) {
1133 $query .=
' AND ' . $table .
'.' . $ctrl[
'delete'] .
'=0';
1135 if ($ctrl[
'versioningWS']) {
1136 if (!$this->versioningPreview) {
1140 }
elseif ($table !==
'pages') {
1143 $query .=
' AND (' .
1144 $table .
'.t3ver_wsid=0 OR ' .
1145 $table .
'.t3ver_wsid=' . (int)$this->versioningWorkspaceId .
1150 if (!$noVersionPreview && empty($ignore_array[
'pid'])) {
1151 $query .=
' AND ' . $table .
'.pid<>-1';
1156 if (is_array($ctrl[
'enablecolumns'])) {
1159 if (!$this->versioningPreview || !$ctrl[
'versioningWS'] || $noVersionPreview) {
1160 if ($ctrl[
'enablecolumns'][
'disabled'] && !$show_hidden && !$ignore_array[
'disabled']) {
1161 $field = $table .
'.' . $ctrl[
'enablecolumns'][
'disabled'];
1162 $query .=
' AND ' . $field .
'=0';
1164 if ($ctrl[
'enablecolumns'][
'starttime'] && !$ignore_array[
'starttime']) {
1165 $field = $table .
'.' . $ctrl[
'enablecolumns'][
'starttime'];
1166 $query .=
' AND ' . $field .
'<=' .
$GLOBALS[
'SIM_ACCESS_TIME'];
1168 if ($ctrl[
'enablecolumns'][
'endtime'] && !$ignore_array[
'endtime']) {
1169 $field = $table .
'.' . $ctrl[
'enablecolumns'][
'endtime'];
1170 $query .=
' AND (' . $field .
'=0 OR ' . $field .
'>' .
$GLOBALS[
'SIM_ACCESS_TIME'] .
')';
1172 if ($ctrl[
'enablecolumns'][
'fe_group'] && !$ignore_array[
'fe_group']) {
1173 $field = $table .
'.' . $ctrl[
'enablecolumns'][
'fe_group'];
1179 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'addEnableColumns'])) {
1182 'show_hidden' => $show_hidden,
1183 'ignore_array' => $ignore_array,
1186 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_page.php'][
'addEnableColumns'] as $_funcRef) {
1193 throw new \InvalidArgumentException(
'There is no entry in the $TCA array for the table "' . $table .
'". This means that the function enableFields() is ' .
'called with an invalid table name as argument.', 1283790586);
1210 $orChecks = array();
1212 $orChecks[] = $field .
'=\'\'';
1214 $orChecks[] = $field .
' IS NULL';
1216 $orChecks[] = $field .
'=\'0\'';
1217 foreach ($memberGroups as $value) {
1220 return ' AND (' . implode(
' OR ', $orChecks) .
')';
1250 if ($this->versioningPreview && is_array($rr) && (
int)$rr[
'pid'] === -1 &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS']) {
1255 if (isset($rr[
't3ver_oid']) && isset($rr[
't3ver_wsid'])) {
1257 $oid = $rr[
't3ver_oid'];
1258 $wsid = $rr[
't3ver_wsid'];
1262 $newPidRec = $this->
getRawRecord($table, $rr[
'uid'],
't3ver_oid,t3ver_wsid',
true);
1263 if (is_array($newPidRec)) {
1264 $oid = $newPidRec[
't3ver_oid'];
1265 $wsid = $newPidRec[
't3ver_wsid'];
1270 if ($oid && ((
int)$this->versioningWorkspaceId === 0 && $this->
checkWorkspaceAccess($wsid) || (
int)$wsid === (
int)$this->versioningWorkspaceId)) {
1271 $oidRec = $this->
getRawRecord($table, $oid,
'pid',
true);
1272 if (is_array($oidRec)) {
1278 $rr[
'_ORIG_pid'] = $rr[
'pid'];
1279 $rr[
'pid'] = $oidRec[
'pid'];
1285 $rr[
'pid'] = $movePlhRec[
'pid'];
1309 public function versionOL($table, &$row, $unsetMovePointers =
false, $bypassEnableFieldsCheck =
false)
1311 if ($this->versioningPreview && is_array($row)) {
1314 $movePldSwap = $this->
movePlhOL($table, $row);
1319 if ($wsAlt = $this->
getWorkspaceVersionOfRecord($this->versioningWorkspaceId, $table, $row[
'uid'], $fieldNames, $bypassEnableFieldsCheck)) {
1320 if (is_array($wsAlt)) {
1324 $wsAlt[
'_ORIG_pid'] = $wsAlt[
'pid'];
1326 $wsAlt[
'pid'] = $row[
'pid'];
1331 $wsAlt[
'_ORIG_uid'] = $wsAlt[
'uid'];
1332 $wsAlt[
'uid'] = $row[
'uid'];
1334 if ($table ===
'pages') {
1335 $wsAlt[
'alias'] = $row[
'alias'];
1355 ) && $unsetMovePointers
1368 if ($wsAlt <= -1 || $versionState->indicatesPlaceholder()) {
1389 if (!empty(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS'])
1394 if (!isset($row[
't3ver_move_id'])) {
1395 $moveIDRec = $this->
getRawRecord($table, $row[
'uid'],
't3ver_move_id',
true);
1396 $moveID = $moveIDRec[
't3ver_move_id'];
1398 $moveID = $row[
't3ver_move_id'];
1425 if ($this->versioningPreview) {
1426 $workspace = (int)$this->versioningWorkspaceId;
1427 if (!empty(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS']) && $workspace !== 0) {
1431 t3ver_move_id=' . (
int)$uid .
' AND
1432 t3ver_wsid=' . (
int)$workspace . $this->
deleteClause($table));
1433 if (is_array($row)) {
1454 if ($workspace !== 0 && !empty(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS'])) {
1455 $workspace = (int)$workspace;
1458 $enFields = $this->
enableFields($table, -1, array(),
true);
1461 t3ver_oid=' . $uid .
' AND
1462 t3ver_wsid=' . $workspace . $this->
deleteClause($table));
1465 if (is_array($newrow)) {
1466 if ($bypassEnableFieldsCheck || $this->
getDatabaseConnection()->exec_SELECTgetSingleRow(
'uid', $table,
'pid=-1 AND
1467 t3ver_oid=' . $uid .
' AND
1468 t3ver_wsid=' . $workspace . $enFields)) {
1478 if ($bypassEnableFieldsCheck || $this->
getDatabaseConnection()->exec_SELECTgetSingleRow(
'uid', $table,
'uid=' . $uid . $enFields)) {
1503 if (isset($this->workspaceCache[$wsid])) {
1504 $ws = $this->workspaceCache[$wsid];
1508 $ws = $this->
getDatabaseConnection()->exec_SELECTgetSingleRow(
'*',
'sys_workspace',
'uid=' . (
int)$wsid .
' AND deleted=0');
1509 if (!is_array($ws)) {
1516 $this->workspaceCache[$wsid] = $ws;
1518 return (
string)$ws[
'_ACCESS'] !==
'';
1529 public function getFileReferences($tableName, $fieldName, array $element)
1533 $currentId = !empty($element[
'uid']) ? $element[
'uid'] : 0;
1537 $references = $fileRepository->findByRelation($tableName, $fieldName, $currentId);
1538 }
catch (FileDoesNotExistException $e) {
1544 }
catch (\InvalidArgumentException $e) {
1549 $logMessage = $e->getMessage() .
' (table: "' . $tableName .
'", fieldName: "' . $fieldName .
'", currentId: ' . $currentId .
')';
1554 $localizedId = null;
1555 if (isset($element[
'_LOCALIZED_UID'])) {
1556 $localizedId = $element[
'_LOCALIZED_UID'];
1557 }
elseif (isset($element[
'_PAGES_OVERLAY_UID'])) {
1558 $localizedId = $element[
'_PAGES_OVERLAY_UID'];
1561 if (!empty(
$GLOBALS[
'TCA'][$tableName][
'ctrl'][
'transForeignTable'])) {
1562 $tableName =
$GLOBALS[
'TCA'][$tableName][
'ctrl'][
'transForeignTable'];
1565 $isTableLocalizable = (
1566 !empty(
$GLOBALS[
'TCA'][$tableName][
'ctrl'][
'languageField'])
1567 && !empty(
$GLOBALS[
'TCA'][$tableName][
'ctrl'][
'transOrigPointerField'])
1569 if ($isTableLocalizable && $localizedId !== null) {
1570 $localizedReferences = $fileRepository->findByRelation($tableName, $fieldName, $localizedId);
1571 $localizedReferencesValue = $localizedReferences ?:
'';
1573 $references = $localizedReferences;
1589 foreach ($this->computedPropertyNames as $computedPropertyName) {
1590 if (array_key_exists($computedPropertyName, $row)) {
1591 unset($row[$computedPropertyName]);
1607 $l10n_mode = isset(
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'l10n_mode'])
1608 ?
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'l10n_mode']
1611 $shouldFieldBeOverlaid =
true;
1613 if ($l10n_mode ===
'exclude') {
1614 $shouldFieldBeOverlaid =
false;
1615 }
elseif ($l10n_mode ===
'mergeIfNotBlank') {
1616 $checkValue = $value;
1619 if (empty($value) &&
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'type'] ===
'group') {
1623 if ($checkValue === array() || !is_array($checkValue) && trim($checkValue) ===
'') {
1624 $shouldFieldBeOverlaid =
false;
1628 return $shouldFieldBeOverlaid;