2 declare(strict_types = 1);
31 return 'pagesLanguageOverlayBeGroupsAccessRights';
36 return 'Merge be_groups access rights from pages_language_overlay to pages';
41 $beGroupsQueryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
44 $beGroupsQueryBuilder->getRestrictions()->removeAll();
45 $beGroupsRows = $beGroupsQueryBuilder
46 ->select(
'uid',
'non_exclude_fields',
'tables_modify')
49 while ($beGroupsRow = $beGroupsRows->fetch()) {
50 $updateNeeded =
false;
51 if (!empty($beGroupsRow[
'tables_modify'])) {
54 $tablesArray = GeneralUtility::trimExplode(
',', $beGroupsRow[
'tables_modify'],
true);
55 $newTablesArray = $tablesArray;
56 if (in_array(
'pages_language_overlay', $tablesArray,
true)) {
58 $newTablesArray = array_diff($tablesArray, [
'pages_language_overlay']);
59 if (!in_array(
'pages', $newTablesArray,
true)) {
60 $newTablesArray[] =
'pages';
66 if (!empty($beGroupsRow[
'non_exclude_fields'])) {
69 $excludeFields = GeneralUtility::trimExplode(
',', $beGroupsRow[
'non_exclude_fields'],
true);
70 $newExcludeFields = [];
71 foreach ($excludeFields as $tableFieldCombo) {
72 if (strpos($tableFieldCombo,
'pages_language_overlay:') === 0) {
74 $field = substr($tableFieldCombo, strlen(
'pages_language_overlay:'));
75 $newExcludeFields[] =
'pages:' . $field;
77 $newExcludeFields[] = $tableFieldCombo;
80 array_unique($newExcludeFields);
82 $newExcludeFields = [];
85 $updateBeGroupsQueryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
86 ->getQueryBuilderForTable(
'be_groups');
87 $updateBeGroupsQueryBuilder
89 ->set(
'tables_modify', implode(
',', $newTablesArray))
90 ->set(
'non_exclude_fields', implode(
',', $newExcludeFields))
92 $updateBeGroupsQueryBuilder->expr()->eq(
94 $updateBeGroupsQueryBuilder->createNamedParameter($beGroupsRow[
'uid'], \PDO::PARAM_INT)
117 DatabaseUpdatedPrerequisite::class
123 return 'The table pages_language_overlay will be removed to align the translation ' .
124 'handling for pages with the rest of the core. This wizard transfers all be_groups with ' .
125 'access restrictions to pages_language_overlay into pages.';
133 return GeneralUtility::makeInstance(
136 'Do you want to continue?',