2 namespace TYPO3\CMS\Install\Updates;
27 protected $title =
'Migrate the workspaces notification settings to the enhanced schema';
53 'sys_workspace_stage',
57 if ($workspacesCount + $stagesCount > 0) {
58 $description =
'The workspaces notification settings have been extended'
59 .
' and need to be migrated to the new definitions. This update wizard'
60 .
' upgrades the accordant settings in the availble workspaces and stages.';
76 public function performUpdate(array &$databaseQueries, &$customMessages)
80 $workspaceRecords = $databaseConnection->exec_SELECTgetRows(
'*',
'sys_workspace',
'deleted=0');
81 foreach ($workspaceRecords as $workspaceRecord) {
83 if ($update !== null) {
84 $databaseConnection->exec_UPDATEquery(
'sys_workspace',
'uid=' . (
int)$workspaceRecord[
'uid'], $update);
85 $databaseQueries[] = $databaseConnection->debug_lastBuiltQuery;
89 $stageRecords = $databaseConnection->exec_SELECTgetRows(
'*',
'sys_workspace_stage',
'deleted=0');
90 foreach ($stageRecords as $stageRecord) {
92 if ($update !== null) {
93 $databaseConnection->exec_UPDATEquery(
'sys_workspace_stage',
'uid=' . (
int)$stageRecord[
'uid'], $update);
94 $databaseQueries[] = $databaseConnection->debug_lastBuiltQuery;
110 if (empty($workspaceRecord[
'uid'])) {
115 $update = $this->
mapSettings($workspaceRecord, $update,
'edit',
'edit');
116 $update = $this->
mapSettings($workspaceRecord, $update,
'publish',
'publish');
117 $update = $this->
mapSettings($workspaceRecord, $update,
'publish',
'execute');
129 if (empty($stageRecord[
'uid'])) {
134 $update = $this->
mapSettings($stageRecord, $update);
147 protected function mapSettings(array $record, array $update, $from =
'', $to =
'')
149 $fromPrefix = ($from ? $from .
'_' :
'');
150 $toPrefix = ($to ? $to .
'_' :
'');
154 if ($record[$fromPrefix .
'allow_notificaton_settings']) {
158 if ((
int)$record[$fromPrefix .
'notification_mode'] === 0) {
163 if (isset($record[
'responsible_persons'])) {
166 }
elseif ($to ===
'edit') {
169 }
elseif ($to ===
'publish') {
173 $preselection = 1 + 2;
176 $update[$toPrefix .
'allow_notificaton_settings'] = $settings;
177 $update[$toPrefix .
'notification_preselection'] = $preselection;