1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* CalMigrationUpdate |
5
|
|
|
*/ |
6
|
|
|
namespace HDNET\Calendarize\Updates; |
7
|
|
|
|
8
|
|
|
use HDNET\Calendarize\Service\IndexerService; |
9
|
|
|
use HDNET\Calendarize\Utility\HelperUtility; |
10
|
|
|
use TYPO3\CMS\Backend\Utility\BackendUtility; |
11
|
|
|
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
12
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
13
|
|
|
use TYPO3\CMS\Install\Updates\AbstractUpdate; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* CalMigrationUpdate |
17
|
|
|
* |
18
|
|
|
* If using the slots please use the m with func_get_args! |
19
|
|
|
* Example: |
20
|
|
|
* /** |
21
|
|
|
* * @signalClass \HDNET\Calendarize\Updates\CalMigrationUpdate |
22
|
|
|
* * @signalName getCalendarizeEventUid |
23
|
|
|
* * |
24
|
|
|
* *@return array |
25
|
|
|
* * |
26
|
|
|
* public function getCalendarizeEventUid() |
27
|
|
|
* { |
28
|
|
|
* $args = func_get_args(); |
29
|
|
|
* list($table, $dbQueries, $call) = $args; |
30
|
|
|
* |
31
|
|
|
* $variables = [ |
32
|
|
|
* 'table' => self::EVENT_TABLE, |
33
|
|
|
* 'dbQueries' => $dbQueries |
34
|
|
|
* ]; |
35
|
|
|
* |
36
|
|
|
* return $variables; |
37
|
|
|
* } |
38
|
|
|
* |
39
|
|
|
*/ |
40
|
|
|
class CalMigrationUpdate extends AbstractUpdate |
41
|
|
|
{ |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Import prefix |
45
|
|
|
*/ |
46
|
|
|
const IMPORT_PREFIX = 'calMigration:'; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Event table |
50
|
|
|
*/ |
51
|
|
|
const EVENT_TABLE = 'tx_calendarize_domain_model_event'; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Configuration table |
55
|
|
|
*/ |
56
|
|
|
const CONFIGURATION_TABLE = 'tx_calendarize_domain_model_configuration'; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* ConfigurationGroup table |
60
|
|
|
*/ |
61
|
|
|
const CONFIGURATION_GROUP_TABLE = 'tx_calendarize_domain_model_configurationgroup'; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* The human-readable title of the upgrade wizard |
65
|
|
|
* |
66
|
|
|
* @var string |
67
|
|
|
*/ |
68
|
|
|
protected $title = 'Migrate cal event structures to the new calendarize event structures. |
69
|
|
|
Try to migrate all cal information and place the new calendarize event models in the same folder |
70
|
|
|
as the cal-records. Please note: the migration will be create calendarize default models.'; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Checks whether updates are required. |
74
|
|
|
* |
75
|
|
|
* @param string &$description The description for the update |
76
|
|
|
* |
77
|
|
|
* @return bool Whether an update is required (TRUE) or not (FALSE) |
78
|
|
|
*/ |
79
|
|
|
public function checkForUpdate(&$description) |
80
|
|
|
{ |
81
|
|
|
$nonMigratedCalIds = $this->getNonMigratedCalIds(); |
82
|
|
|
$count = count($nonMigratedCalIds); |
83
|
|
|
if ($count === 0) { |
84
|
|
|
return false; |
85
|
|
|
} |
86
|
|
|
$description = 'There ' . ($count > 1 ? 'are ' . $count : 'is ' . $count) . ' non migrated EXT:cal event |
87
|
|
|
' . ($count > 1 ? 's' : '') . '. Run the update process to migrate the events to EXT:calendarize events.'; |
88
|
|
|
return true; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Performs the accordant updates. |
93
|
|
|
* |
94
|
|
|
* @param array &$dbQueries Queries done in this update |
95
|
|
|
* @param mixed &$customMessages Custom messages |
96
|
|
|
* |
97
|
|
|
* @return bool Whether everything went smoothly or not |
98
|
|
|
*/ |
99
|
|
|
public function performUpdate(array &$dbQueries, &$customMessages) |
100
|
|
|
{ |
101
|
|
|
$calIds = $this->getNonMigratedCalIds(); |
102
|
|
|
$this->performSysCategoryUpdate($calIds, $dbQueries, $customMessages); |
103
|
|
|
$this->performSysFileReferenceUpdate($calIds, $dbQueries, $customMessages); |
104
|
|
|
$this->performExceptionEventUpdate($calIds, $dbQueries, $customMessages); |
105
|
|
|
$this->performCalEventUpdate($calIds, $dbQueries, $customMessages); |
106
|
|
|
$this->performLinkEventToCategory($calIds, $dbQueries, $customMessages); |
107
|
|
|
$this->performLinkEventToConfigurationGroup($calIds, $dbQueries, $customMessages); |
108
|
|
|
|
109
|
|
|
return true; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @param $calIds |
114
|
|
|
* @param array $dbQueries |
115
|
|
|
* @param $customMessages |
116
|
|
|
* |
117
|
|
|
* @return bool |
118
|
|
|
*/ |
119
|
|
|
public function performCalEventUpdate($calIds, array &$dbQueries, &$customMessages) |
|
|
|
|
120
|
|
|
{ |
121
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
122
|
|
|
|
123
|
|
|
$events = $db->exec_SELECTgetRows('*', 'tx_cal_event', 'uid IN (' . implode(',', $calIds) . ')'); |
124
|
|
|
foreach ($events as $event) { |
|
|
|
|
125
|
|
|
$calendarizeEventRecord = [ |
126
|
|
|
'pid' => $event['pid'], |
127
|
|
|
'import_id' => self::IMPORT_PREFIX . (int)$event['uid'], |
128
|
|
|
'tstamp' => $event['tstamp'], |
129
|
|
|
'crdate' => $event['crdate'], |
130
|
|
|
'hidden' => $event['hidden'], |
131
|
|
|
'starttime' => $event['starttime'], |
132
|
|
|
'endtime' => $event['endtime'], |
133
|
|
|
'title' => $event['title'], |
134
|
|
|
'organizer' => $event['organizer'], |
135
|
|
|
'location' => $event['location'], |
136
|
|
|
'abstract' => $event['teaser'], |
137
|
|
|
'description' => $event['description'], |
138
|
|
|
'images' => $event['image'], |
139
|
|
|
'downloads' => $event['attachment'], |
140
|
|
|
'calendarize' => $this->buildConfigurations($event, $dbQueries) |
141
|
|
|
]; |
142
|
|
|
|
143
|
|
|
$variables = [ |
144
|
|
|
'calendarizeEventRecord' => $calendarizeEventRecord, |
145
|
|
|
'event' => $event, |
146
|
|
|
'table' => self::EVENT_TABLE, |
147
|
|
|
'dbQueries' => $dbQueries |
148
|
|
|
]; |
149
|
|
|
|
150
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
151
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__ . 'PreInsert', $variables); |
152
|
|
|
|
153
|
|
|
$query = $db->INSERTquery($variables['table'], $variables['calendarizeEventRecord']); |
154
|
|
|
$db->admin_query($query); |
155
|
|
|
$dbQueries[] = $query; |
156
|
|
|
|
157
|
|
|
$variablesPostInsert = [ |
158
|
|
|
'calendarizeEventRecord' => $calendarizeEventRecord, |
159
|
|
|
'event' => $event, |
160
|
|
|
'table' => $variables['table'], |
161
|
|
|
'recordId' => $db->sql_insert_id(), |
162
|
|
|
'dbQueries' => $dbQueries |
163
|
|
|
]; |
164
|
|
|
|
165
|
|
|
|
166
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
167
|
|
|
$dispatcher->dispatch(__CLASS__, __FUNCTION__ . 'PostInsert', $variablesPostInsert); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
$indexer = GeneralUtility::makeInstance(IndexerService::class); |
171
|
|
|
$indexer->reindexAll(); |
172
|
|
|
|
173
|
|
|
return true; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @param $calIds |
178
|
|
|
* @param array $dbQueries |
179
|
|
|
* @param array $customMessages |
180
|
|
|
* |
181
|
|
|
* @return bool |
182
|
|
|
*/ |
183
|
|
|
public function performExceptionEventUpdate($calIds, &$dbQueries, &$customMessages) |
|
|
|
|
184
|
|
|
{ |
185
|
|
|
// ConfigurationGroup für jede ExceptionGroup |
186
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
187
|
|
|
$variables = [ |
188
|
|
|
'table' => 'tx_cal_exception_event_group', |
189
|
|
|
'dbQueries' => $dbQueries, |
190
|
|
|
'calIds' => $calIds |
191
|
|
|
]; |
192
|
|
|
|
193
|
|
|
$selectWhere = '1 = 1 ' . BackendUtility::deleteClause($variables['table']); |
194
|
|
|
$selectQuery = $db->SELECTquery('*', $variables['table'], $selectWhere); |
195
|
|
|
$selectResults = $db->admin_query($selectQuery); |
196
|
|
|
$dbQueries[] = $selectQuery; |
197
|
|
|
|
198
|
|
|
foreach ($selectResults as $selectResult) { |
|
|
|
|
199
|
|
|
$group = [ |
200
|
|
|
'pid' => $selectResult['pid'], |
201
|
|
|
'tstamp' => $selectResult['tstamp'], |
202
|
|
|
'crdate' => $selectResult['crdate'], |
203
|
|
|
'cruser_id' => $selectResult['cruser_id'], |
204
|
|
|
'title' => $selectResult['title'], |
205
|
|
|
'configurations' => $this->getExceptionConfigurationForExceptionGroup($selectResult['uid']), // get Configuration |
|
|
|
|
206
|
|
|
'hidden' => $selectResult['hidden'], |
207
|
|
|
'import_id' => self::IMPORT_PREFIX . $selectResult['uid'] |
208
|
|
|
]; |
209
|
|
|
|
210
|
|
|
$insertQuery = $db->INSERTquery(self::CONFIGURATION_GROUP_TABLE, $group); |
211
|
|
|
$db->admin_query($insertQuery); |
212
|
|
|
$dbQueries[] = $insertQuery; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
return true; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @TODO |
220
|
|
|
* |
221
|
|
|
* @param $calIds |
222
|
|
|
* @param $dbQueries |
223
|
|
|
* @param $customMessages |
224
|
|
|
* |
225
|
|
|
* @return bool |
226
|
|
|
*/ |
227
|
|
|
public function performLinkEventToConfigurationGroup($calIds, &$dbQueries, &$customMessages) |
228
|
|
|
{ |
229
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
230
|
|
|
$now = new \DateTime(); |
231
|
|
|
|
232
|
|
|
$variables = [ |
233
|
|
|
'table' => self::CONFIGURATION_GROUP_TABLE, |
234
|
|
|
'dbQueries' => $dbQueries, |
235
|
|
|
'calIds' => $calIds |
236
|
|
|
]; |
237
|
|
|
|
238
|
|
|
$selectWhere = '1 = 1'; |
239
|
|
|
$selectQuery = $db->SELECTquery('*', $variables['table'], $selectWhere); |
240
|
|
|
$selectResults = $db->admin_query($selectQuery); |
241
|
|
|
$dbQueries[] = $selectQuery; |
242
|
|
|
|
243
|
|
|
foreach ($selectResults as $group) { |
|
|
|
|
244
|
|
|
$importId = explode(':', $group['import_id']); |
245
|
|
|
$groupId = (int)$importId[1]; |
246
|
|
|
|
247
|
|
|
$variables = [ |
248
|
|
|
'table' => 'tx_cal_exception_event_mm', |
249
|
|
|
'dbQueries' => $dbQueries, |
250
|
|
|
'calIds' => $calIds |
251
|
|
|
]; |
252
|
|
|
|
253
|
|
|
$selectWhere = 'tablenames = \'tx_cal_exception_event_group\' AND uid_foreign = ' . $groupId; |
254
|
|
|
$selectQuery = $db->SELECTquery('uid_local', $variables['table'], $selectWhere); |
255
|
|
|
$selectResults = $db->admin_query($selectQuery); |
256
|
|
|
$dbQueries[] = $selectQuery; |
257
|
|
|
|
258
|
|
|
foreach ($selectResults as $eventUid) { |
|
|
|
|
259
|
|
|
$eventImportId = self::IMPORT_PREFIX . (int)$eventUid['uid_local']; |
260
|
|
|
$configurationRow = [ |
261
|
|
|
'pid' => (int)$group['pid'], |
262
|
|
|
'tstamp' => $now->getTimestamp(), |
263
|
|
|
'crdate' => $now->getTimestamp(), |
264
|
|
|
'type' => 'group', |
265
|
|
|
'handling' => 'exclude', |
266
|
|
|
'groups' => $group['uid'] |
267
|
|
|
]; |
268
|
|
|
|
269
|
|
|
$this->updateEventWithConfiguration($eventImportId, $configurationRow, $dbQueries, $customMessages); |
270
|
|
|
} |
271
|
|
|
} |
272
|
|
|
return true; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* @param $eventImportId |
277
|
|
|
* @param $configuration |
278
|
|
|
* @param $dbQueries |
279
|
|
|
* @param $customMessages |
280
|
|
|
* |
281
|
|
|
* @return bool|\mysqli_result|object |
282
|
|
|
*/ |
283
|
|
|
protected function updateEventWithConfiguration($eventImportId, $configuration, &$dbQueries, &$customMessages) |
284
|
|
|
{ |
285
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
286
|
|
|
$configurationRow = $this->findEventExcludeConfiguration($eventImportId, $dbQueries, $customMessages); |
287
|
|
|
if ($configurationRow) { |
288
|
|
|
$configurationRow['groups'] = $this->addValueToCsv($configurationRow['groups'], $configuration['groups']); |
289
|
|
|
|
290
|
|
|
$updateWhere = 'uid = ' . (int)$configurationRow['uid']; |
291
|
|
|
unset($configurationRow['uid']); |
292
|
|
|
$updateQuery = $db->UPDATEquery(self::CONFIGURATION_TABLE, $updateWhere, $configurationRow); |
|
|
|
|
293
|
|
|
$results = $db->admin_query($updateQuery); |
294
|
|
|
$dbQueries[] = $updateQuery; |
295
|
|
|
} else { |
296
|
|
|
$insertQuery = $db->INSERTquery(self::CONFIGURATION_TABLE, $configuration); |
297
|
|
|
$db->admin_query($insertQuery); |
298
|
|
|
$dbQueries[] = $insertQuery; |
299
|
|
|
|
300
|
|
|
$configurationId = $db->sql_insert_id(); |
301
|
|
|
|
302
|
|
|
$results = $this->addConfigurationIdToEvent($eventImportId, $configurationId, $dbQueries, $customMessages); |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
return $results; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* @param string $csv |
310
|
|
|
* @param string $value |
311
|
|
|
* |
312
|
|
|
* @return string |
313
|
|
|
*/ |
314
|
|
|
protected function addValueToCsv($csv, $value) |
315
|
|
|
{ |
316
|
|
|
$csvArray = GeneralUtility::trimExplode(',', $csv); |
317
|
|
|
|
318
|
|
|
// check for doubles |
319
|
|
|
$values = array_flip($csvArray); |
320
|
|
|
if (isset($values[$value])) { |
321
|
|
|
return $csv; |
322
|
|
|
} |
323
|
|
|
$csvArray[] = $value; |
324
|
|
|
$csv = implode(',', $csvArray); |
325
|
|
|
|
326
|
|
|
return $csv; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @param string $eventImportId |
331
|
|
|
* @param int $configurationId |
332
|
|
|
* @param array $dbQueries |
333
|
|
|
* @param array $customMessages |
334
|
|
|
* |
335
|
|
|
* @return bool|\mysqli_result|object |
336
|
|
|
*/ |
337
|
|
|
protected function addConfigurationIdToEvent($eventImportId, $configurationId, &$dbQueries, &$customMessages) |
338
|
|
|
{ |
339
|
|
|
$event = $this->findEventByImportId($eventImportId, $dbQueries, $customMessages); |
340
|
|
|
if (!$event) { |
341
|
|
|
return false; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
$event['calendarize'] = $this->addValueToCsv($event['calendarize'], $configurationId); |
345
|
|
|
|
346
|
|
|
return $this->updateEvent($event['uid'], $event, $dbQueries, $customMessages); |
|
|
|
|
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* @param int $eventId |
351
|
|
|
* @param array $values |
352
|
|
|
* @param array $dbQueries |
353
|
|
|
* @param array $customMessages |
354
|
|
|
* |
355
|
|
|
* @return bool|\mysqli_result|object |
356
|
|
|
*/ |
357
|
|
|
protected function updateEvent($eventId, $values, &$dbQueries, &$customMessages) |
|
|
|
|
358
|
|
|
{ |
359
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
360
|
|
|
|
361
|
|
|
$variables = [ |
362
|
|
|
'table' => self::EVENT_TABLE, |
363
|
|
|
'eventId' => (int)$eventId, |
364
|
|
|
'values' => $values, |
365
|
|
|
'dbQueries' => $dbQueries |
366
|
|
|
]; |
367
|
|
|
|
368
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
369
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__, $variables); |
370
|
|
|
|
371
|
|
|
$updateWhere = 'uid = ' . (int)$eventId; |
372
|
|
|
unset($values['uid']); |
373
|
|
|
$updateQuery = $db->UPDATEquery($variables['table'], $updateWhere, $variables['values']); |
374
|
|
|
$updateResults = $db->admin_query($updateQuery); |
375
|
|
|
$dbQueries[] = $updateQuery; |
376
|
|
|
|
377
|
|
|
return $updateResults; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* @param $eventImportId |
382
|
|
|
* @param $dbQueries |
383
|
|
|
* @param $customMessages |
384
|
|
|
* |
385
|
|
|
* @return array|bool |
386
|
|
|
*/ |
387
|
|
|
protected function findEventByImportId($eventImportId, &$dbQueries, &$customMessages) |
|
|
|
|
388
|
|
|
{ |
389
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
390
|
|
|
|
391
|
|
|
$variables = [ |
392
|
|
|
'table' => self::EVENT_TABLE, |
393
|
|
|
'dbQueries' => $dbQueries, |
394
|
|
|
'eventImportId' => $eventImportId |
395
|
|
|
]; |
396
|
|
|
|
397
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
398
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__, $variables); |
399
|
|
|
|
400
|
|
|
$selectWhere = 'import_id = \'' . $variables['eventImportId'] . '\''; |
401
|
|
|
$selectQuery = $db->SELECTquery('*', $variables['table'], $selectWhere); |
402
|
|
|
$selectResults = $db->admin_query($selectQuery); |
403
|
|
|
$dbQueries[] = $selectQuery; |
404
|
|
|
|
405
|
|
|
if (!$selectResults) { |
406
|
|
|
return false; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
$result = $db->sql_fetch_assoc($selectResults); |
410
|
|
|
|
411
|
|
|
return $result; |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* @param string $eventImportId |
416
|
|
|
* @param array $dbQueries |
417
|
|
|
* @param array $customMessages |
418
|
|
|
* |
419
|
|
|
* @return array|bool |
420
|
|
|
*/ |
421
|
|
|
protected function findEventExcludeConfiguration($eventImportId, &$dbQueries, &$customMessages) |
422
|
|
|
{ |
423
|
|
|
$event = $this->findEventByImportId($eventImportId, $dbQueries, $customMessages); |
424
|
|
|
|
425
|
|
|
if (!$event) { |
426
|
|
|
return false; |
427
|
|
|
} |
428
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
429
|
|
|
|
430
|
|
|
$variables = [ |
431
|
|
|
'table' => self::CONFIGURATION_TABLE, |
432
|
|
|
'dbQueries' => $dbQueries, |
433
|
|
|
'event' => $event |
434
|
|
|
]; |
435
|
|
|
|
436
|
|
|
$configurationWhere = 'type = \'group\' AND handling = \'exclude\' AND uid IN (\'' . $variables['event']['calendarize'] . '\')'; |
437
|
|
|
$configurationQuery = $db->SELECTquery('*', $variables['table'], $configurationWhere); |
438
|
|
|
$configurationResults = $db->admin_query($configurationQuery); |
439
|
|
|
$dbQueries[] = $configurationQuery; |
440
|
|
|
|
441
|
|
|
$configuration = $db->sql_fetch_assoc($configurationResults); |
442
|
|
|
return $configuration; |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/** |
446
|
|
|
* @param $groupId |
447
|
|
|
* @param array $dbQueries |
448
|
|
|
* @param array $customMessages |
449
|
|
|
* |
450
|
|
|
* @return string |
451
|
|
|
*/ |
452
|
|
|
protected function getExceptionConfigurationForExceptionGroup($groupId, &$dbQueries, &$customMessages) |
|
|
|
|
453
|
|
|
{ |
454
|
|
|
$recordIds = []; |
455
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
456
|
|
|
$variables = [ |
457
|
|
|
'table' => ' tx_cal_exception_event_group_mm', |
458
|
|
|
'dbQueries' => $dbQueries |
459
|
|
|
]; |
460
|
|
|
|
461
|
|
|
$mmWhere = 'uid_local = ' . (int)$groupId; |
462
|
|
|
$mmQuery = $db->SELECTquery('*', $variables['table'], $mmWhere); |
463
|
|
|
$mmResults = $db->admin_query($mmQuery); |
464
|
|
|
$dbQueries[] = $mmQuery; |
465
|
|
|
|
466
|
|
|
foreach ($mmResults as $mmResult) { |
|
|
|
|
467
|
|
|
$variables = [ |
468
|
|
|
'table' => ' tx_cal_exception_event', |
469
|
|
|
'dbQueries' => $dbQueries |
470
|
|
|
]; |
471
|
|
|
|
472
|
|
|
$selectWhere = 'uid = ' . (int)$mmResult['uid_foreign']; |
473
|
|
|
$selectQuery = $db->SELECTquery('*', $variables['table'], $selectWhere); |
474
|
|
|
$selectResults = $db->admin_query($selectQuery); |
475
|
|
|
$dbQueries[] = $selectQuery; |
476
|
|
|
|
477
|
|
|
foreach ($selectResults as $selectResult) { |
|
|
|
|
478
|
|
|
$configurationRow = [ |
479
|
|
|
'pid' => $selectResult['pid'], |
480
|
|
|
'tstamp' => $selectResult['tstamp'], |
481
|
|
|
'crdate' => $selectResult['crdate'], |
482
|
|
|
'type' => 'time', |
483
|
|
|
'handling' => 'include', |
484
|
|
|
'start_date' => $this->migrateDate($selectResult['start_date']), |
485
|
|
|
'end_date' => $this->migrateDate($selectResult['end_date']), |
486
|
|
|
'start_time' => (int)$selectResult['start_time'], |
487
|
|
|
'end_time' => (int)$selectResult['end_time'], |
488
|
|
|
'all_day' => ($selectResult['start_time'] == null && $selectResult['end_time'] == null) ? 1 : 0, |
489
|
|
|
'frequency' => $this->mapFrequency($selectResult['freq']), |
490
|
|
|
'till_date' => $this->migrateDate($selectResult['until']), |
491
|
|
|
'counter_amount' => (int)$selectResult['cnt'], |
492
|
|
|
'counter_interval' => (int)$selectResult['interval'], |
493
|
|
|
'import_id' => self::IMPORT_PREFIX . $selectResult['uid'] |
494
|
|
|
]; |
495
|
|
|
|
496
|
|
|
$variables = [ |
497
|
|
|
'table' => self::CONFIGURATION_TABLE, |
498
|
|
|
'configurationRow' => $configurationRow |
499
|
|
|
]; |
500
|
|
|
|
501
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
502
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__ . 'PreInsert', $variables); |
503
|
|
|
|
504
|
|
|
$query = $db->INSERTquery($variables['table'], $variables['configurationRow']); |
505
|
|
|
$db->admin_query($query); |
506
|
|
|
$dbQueries[] = $query; |
507
|
|
|
$recordIds[] = (int)$db->sql_insert_id(); |
508
|
|
|
} |
509
|
|
|
} |
510
|
|
|
|
511
|
|
|
return implode(',', $recordIds); |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
/** |
515
|
|
|
* @param string $calFrequency |
516
|
|
|
* |
517
|
|
|
* @return string |
518
|
|
|
*/ |
519
|
|
|
protected function mapFrequency($calFrequency) |
520
|
|
|
{ |
521
|
|
|
$freq = [ |
522
|
|
|
'none' => null, |
523
|
|
|
'day' => 'daily', |
524
|
|
|
'week' => 'weekly', |
525
|
|
|
'month' => 'monthly', |
526
|
|
|
'year' => 'yearly' |
527
|
|
|
]; |
528
|
|
|
|
529
|
|
|
if (!isset($freq[$calFrequency])) { |
530
|
|
|
return ''; |
531
|
|
|
} |
532
|
|
|
|
533
|
|
|
return $freq[$calFrequency]; |
534
|
|
|
} |
535
|
|
|
|
536
|
|
|
/** |
537
|
|
|
* Migrate the 'sys_file_reference' entries from 'tx_cal_event' to 'tx_calendarize_domain_model_event'. |
538
|
|
|
* Mark the imported entries with the import-id. |
539
|
|
|
* |
540
|
|
|
* @param $calIds |
541
|
|
|
* @param array $dbQueries |
542
|
|
|
* @param $customMessages |
543
|
|
|
*/ |
544
|
|
|
public function performSysFileReferenceUpdate($calIds, array &$dbQueries, &$customMessages) |
|
|
|
|
545
|
|
|
{ |
546
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
547
|
|
|
|
548
|
|
|
$variables = [ |
549
|
|
|
'table' => 'tx_cal_event', |
550
|
|
|
'fieldnames' => ['image', 'attachment'], |
551
|
|
|
'dbQueries' => $dbQueries, |
552
|
|
|
'calIds' => $calIds |
553
|
|
|
]; |
554
|
|
|
|
555
|
|
|
// select all not migrated entries |
556
|
|
|
$fieldnames = 'fieldname = \'' . implode('\' OR fieldname = \'', $variables['fieldnames']) . '\''; |
557
|
|
|
$selectWhere = 'tablenames = \'' . $variables['table'] . '\' AND (' . $fieldnames . ')'; |
558
|
|
|
$selectWhere .= ' AND NOT EXISTS (SELECT NULL FROM sys_file_reference sfr2 WHERE sfr2.import_id = CONCAT(\'' . self::IMPORT_PREFIX . '\', sfr1.uid))'; |
559
|
|
|
|
560
|
|
|
$selectQuery = $db->SELECTquery('*', 'sys_file_reference sfr1', $selectWhere); |
561
|
|
|
$selectResults = $db->admin_query($selectQuery); |
562
|
|
|
$dbQueries[] = $selectQuery; |
563
|
|
|
|
564
|
|
|
$variables = [ |
565
|
|
|
'table' => self::EVENT_TABLE, |
566
|
|
|
'fieldnames' => $variables['fieldnames'], |
567
|
|
|
'dbQueries' => $dbQueries, |
568
|
|
|
'calIds' => $calIds, |
569
|
|
|
'selectResults' => $selectResults |
570
|
|
|
]; |
571
|
|
|
|
572
|
|
|
// create new entry with import_id |
573
|
|
|
foreach ($variables['selectResults'] as $selectResult) { |
|
|
|
|
574
|
|
|
$selectResult['tablenames'] = $variables['table']; |
575
|
|
|
$selectResult['import_id'] = self::IMPORT_PREFIX . $selectResult['uid']; |
576
|
|
|
$selectResult['fieldname'] = ($selectResult['fieldname'] == 'image') ? 'images' : 'downloads'; |
577
|
|
|
unset($selectResult['uid_foreign']); |
578
|
|
|
unset($selectResult['uid']); |
579
|
|
|
|
580
|
|
|
$insertQuery = $db->INSERTquery('sys_file_reference', $selectResult); |
581
|
|
|
$db->admin_query($insertQuery); |
582
|
|
|
$dbQueries[] = $insertQuery; |
583
|
|
|
} |
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
/** |
587
|
|
|
* Migrate the 'tx_cal_category' table to the 'sys_category' table. |
588
|
|
|
* |
589
|
|
|
* @param $calIds |
590
|
|
|
* @param array $dbQueries |
591
|
|
|
* @param $customMessages |
592
|
|
|
*/ |
593
|
|
|
protected function performSysCategoryUpdate($calIds, array &$dbQueries, &$customMessages) |
|
|
|
|
594
|
|
|
{ |
595
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
596
|
|
|
|
597
|
|
|
// first migrate from tx_cal_category to sys_category |
598
|
|
|
$variables = [ |
599
|
|
|
'table' => 'tx_cal_category', |
600
|
|
|
'dbQueries' => $dbQueries, |
601
|
|
|
'calIds' => $calIds |
602
|
|
|
]; |
603
|
|
|
|
604
|
|
|
$selectWhere = '1 = 1 ' . BackendUtility::deleteClause($variables['table']); |
605
|
|
|
$selectQuery = $db->SELECTquery('*', $variables['table'], $selectWhere); |
606
|
|
|
$selectResults = $db->admin_query($selectQuery); |
607
|
|
|
$dbQueries[] = $selectQuery; |
608
|
|
|
|
609
|
|
|
foreach ($selectResults as $category) { |
|
|
|
|
610
|
|
|
$sysCategoryRecord = [ |
611
|
|
|
'pid' => $category['pid'], |
612
|
|
|
'tstamp' => $category['tstamp'], |
613
|
|
|
'crdate' => $category['crdate'], |
614
|
|
|
'cruser_id' => $category['cruser_id'], |
615
|
|
|
'deleted' => $category['deleted'], |
616
|
|
|
'hidden' => $category['hidden'], |
617
|
|
|
'starttime' => $category['starttime'], |
618
|
|
|
'endtime' => $category['endtime'], |
619
|
|
|
'sys_language_uid' => $category['sys_language_uid'], |
620
|
|
|
'l10n_parent' => $category['l18n_parent'], |
621
|
|
|
'l10n_diffsource' => $category['l18n_diffsource'], |
622
|
|
|
'title' => $category['title'], |
623
|
|
|
'parent' => (int)$category['parent_category'], |
624
|
|
|
'import_id' => self::IMPORT_PREFIX . (int)$category['uid'], |
625
|
|
|
'sorting' => $category['sorting'] |
626
|
|
|
]; |
627
|
|
|
|
628
|
|
|
$query = $db->INSERTquery('sys_category', $sysCategoryRecord); |
629
|
|
|
$db->admin_query($query); |
630
|
|
|
$dbQueries[] = $query; |
631
|
|
|
} |
632
|
|
|
|
633
|
|
|
// second rewrite the tree |
634
|
|
|
$variables = [ |
635
|
|
|
'table' => 'sys_category', |
636
|
|
|
'dbQueries' => $dbQueries, |
637
|
|
|
'calIds' => $calIds |
638
|
|
|
]; |
639
|
|
|
|
640
|
|
|
$selectWhere = 'import_id != \'\''; |
641
|
|
|
$selectQuery = $db->SELECTquery('*', $variables['table'], $selectWhere); |
642
|
|
|
$selectResults = $db->admin_query($selectQuery); |
643
|
|
|
$dbQueries[] = $selectQuery; |
644
|
|
|
|
645
|
|
|
foreach ($selectResults as $sysCategory) { |
|
|
|
|
646
|
|
|
// update parent, because there are just the old uids |
647
|
|
|
$updateRecord = [ |
648
|
|
|
'parent' => $this->getSysCategoryParentUid(self::IMPORT_PREFIX . (int)$sysCategory['parent']) |
649
|
|
|
]; |
650
|
|
|
$query = $db->UPDATEquery('sys_category', 'uid = ' . $sysCategory['uid'], $updateRecord); |
651
|
|
|
$db->admin_query($query); |
652
|
|
|
$dbQueries[] = $query; |
653
|
|
|
} |
654
|
|
|
} |
655
|
|
|
|
656
|
|
|
/** |
657
|
|
|
* Return the parentUid for the 'sys_category' entry on base of the import_id. |
658
|
|
|
* |
659
|
|
|
* @param string $importId |
660
|
|
|
* |
661
|
|
|
* @return int |
662
|
|
|
*/ |
663
|
|
|
protected function getSysCategoryParentUid($importId) |
664
|
|
|
{ |
665
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
666
|
|
|
|
667
|
|
|
$selectWhere = 'import_id = \'' . $importId . '\''; |
668
|
|
|
$selectQuery = $db->SELECTquery('uid', 'sys_category', $selectWhere); |
669
|
|
|
$selectResults = $db->admin_query($selectQuery); |
670
|
|
|
$dbQueries[] = $selectQuery; |
|
|
|
|
671
|
|
|
|
672
|
|
|
$result = $db->sql_fetch_assoc($selectResults); |
673
|
|
|
$uid = (int)$result['uid']; |
674
|
|
|
|
675
|
|
|
return $uid; |
676
|
|
|
} |
677
|
|
|
|
678
|
|
|
/** |
679
|
|
|
* Link the Events to the migrated Categories. |
680
|
|
|
* This build up the 'sys_category_record_mm' table on base of the 'tx_cal_event_category_mm' table. |
681
|
|
|
* |
682
|
|
|
* @param $calIds |
683
|
|
|
* @param array $dbQueries |
684
|
|
|
* @param array $customMessages |
685
|
|
|
*/ |
686
|
|
|
public function performLinkEventToCategory($calIds, &$dbQueries, &$customMessages) |
|
|
|
|
687
|
|
|
{ |
688
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
689
|
|
|
|
690
|
|
|
$selectQuery = $db->SELECTquery('*', 'tx_cal_event_category_mm', '1 = 1'); |
691
|
|
|
$selectResults = $db->admin_query($selectQuery); |
692
|
|
|
$dbQueries[] = $selectQuery; |
693
|
|
|
|
694
|
|
|
$variables = [ |
695
|
|
|
'tablenames' => self::EVENT_TABLE, |
696
|
|
|
'fieldname' => 'categories', |
697
|
|
|
'dbQueries' => $dbQueries |
698
|
|
|
]; |
699
|
|
|
|
700
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
701
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__, $variables); |
702
|
|
|
|
703
|
|
|
foreach ($selectResults as $mm) { |
|
|
|
|
704
|
|
|
$eventUid = $this->getCalendarizeEventUid(self::IMPORT_PREFIX . $mm['uid_local'], $dbQueries, $customMessages); |
705
|
|
|
$categoryUid = $this->getCalendarizeCategoryUid( |
706
|
|
|
self::IMPORT_PREFIX . $mm['uid_foreign'], |
707
|
|
|
$dbQueries, |
708
|
|
|
$customMessages |
709
|
|
|
); |
710
|
|
|
|
711
|
|
|
$insertValues = [ |
712
|
|
|
'uid_local' => $categoryUid, |
713
|
|
|
'uid_foreign' => $eventUid, |
714
|
|
|
'tablenames' => $variables['tablenames'], |
715
|
|
|
'fieldname' => $variables['fieldname'] |
716
|
|
|
]; |
717
|
|
|
|
718
|
|
|
$insertQuery = $db->INSERTquery('sys_category_record_mm ', $insertValues); |
719
|
|
|
$db->admin_query($insertQuery); |
720
|
|
|
$dbQueries[] = $insertQuery; |
721
|
|
|
} |
722
|
|
|
} |
723
|
|
|
|
724
|
|
|
/** |
725
|
|
|
* Get the event uid on base of the given import_id. |
726
|
|
|
* The import_id is the original tx_cal_event id prefixed with the IMPORT_PREFIX. |
727
|
|
|
* |
728
|
|
|
* @param string $importId |
729
|
|
|
* @param array $dbQueries |
730
|
|
|
* @param array $customMessages |
731
|
|
|
* |
732
|
|
|
* @return int |
733
|
|
|
*/ |
734
|
|
|
protected function getCalendarizeEventUid($importId, &$dbQueries, &$customMessages) |
|
|
|
|
735
|
|
|
{ |
736
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
737
|
|
|
|
738
|
|
|
$variables = [ |
739
|
|
|
'table' => self::EVENT_TABLE, |
740
|
|
|
'dbQueries' => $dbQueries |
741
|
|
|
]; |
742
|
|
|
|
743
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
744
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__, $variables); |
745
|
|
|
|
746
|
|
|
$selectWhere = 'import_id = \'' . $importId . '\''; |
747
|
|
|
$selectQuery = $db->SELECTquery('uid', $variables['table'], $selectWhere); |
748
|
|
|
$selectResults = $db->admin_query($selectQuery); |
749
|
|
|
$dbQueries[] = $selectQuery; |
750
|
|
|
|
751
|
|
|
$result = $db->sql_fetch_assoc($selectResults); |
752
|
|
|
$uid = (int)$result['uid']; |
753
|
|
|
return $uid; |
754
|
|
|
} |
755
|
|
|
|
756
|
|
|
/** |
757
|
|
|
* Get the sys_category uid on base of the given import_id. |
758
|
|
|
* The import_id is the original tx_cal_category id prefixed with the IMPORT_PREFIX. |
759
|
|
|
* |
760
|
|
|
* @see CalMigrationUpdate::IMPORT_PREFIX |
761
|
|
|
* |
762
|
|
|
* @param string $importId |
763
|
|
|
* @param array $dbQueries |
764
|
|
|
* @param array $customMessages |
765
|
|
|
* |
766
|
|
|
* @return int |
767
|
|
|
*/ |
768
|
|
|
protected function getCalendarizeCategoryUid($importId, &$dbQueries, &$customMessages) |
|
|
|
|
769
|
|
|
{ |
770
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
771
|
|
|
|
772
|
|
|
$variables = [ |
773
|
|
|
'table' => 'sys_category', |
774
|
|
|
'dbQueries' => $dbQueries |
775
|
|
|
]; |
776
|
|
|
|
777
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
778
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__, $variables); |
779
|
|
|
|
780
|
|
|
$selectWhere = 'import_id = \'' . $importId . '\''; |
781
|
|
|
$selectQuery = $db->SELECTquery('uid', $variables['table'], $selectWhere); |
782
|
|
|
$selectResults = $db->admin_query($selectQuery); |
783
|
|
|
$dbQueries[] = $selectQuery; |
784
|
|
|
|
785
|
|
|
$result = $db->sql_fetch_assoc($selectResults); |
786
|
|
|
$uid = (int)$result['uid']; |
787
|
|
|
return $uid; |
788
|
|
|
} |
789
|
|
|
|
790
|
|
|
/** |
791
|
|
|
* @param $calEventRow |
792
|
|
|
* @param $dbQueries |
793
|
|
|
* |
794
|
|
|
* @return int |
795
|
|
|
*/ |
796
|
|
|
protected function buildConfigurations($calEventRow, &$dbQueries) |
797
|
|
|
{ |
798
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
799
|
|
|
$configurationRow = [ |
800
|
|
|
'pid' => $calEventRow['pid'], |
801
|
|
|
'tstamp' => $calEventRow['tstamp'], |
802
|
|
|
'crdate' => $calEventRow['crdate'], |
803
|
|
|
'type' => 'time', |
804
|
|
|
'handling' => 'include', |
805
|
|
|
'start_date' => $this->migrateDate($calEventRow['start_date']), |
806
|
|
|
'end_date' => $this->migrateDate($calEventRow['end_date']), |
807
|
|
|
'start_time' => $calEventRow['start_time'], |
808
|
|
|
'end_time' => $calEventRow['end_time'], |
809
|
|
|
'all_day' => $calEventRow['allday'], |
810
|
|
|
'frequency' => $this->mapFrequency($calEventRow['freq']), |
811
|
|
|
'till_date' => $this->migrateDate($calEventRow['until']), |
812
|
|
|
'counter_amount' => (int)$calEventRow['cnt'], |
813
|
|
|
'counter_interval' => (int)$calEventRow['interval'], |
814
|
|
|
|
815
|
|
|
]; |
816
|
|
|
|
817
|
|
|
$variables = [ |
818
|
|
|
'table' => self::CONFIGURATION_TABLE, |
819
|
|
|
'configurationRow' => $configurationRow, |
820
|
|
|
'calEventRow' => $calEventRow, |
821
|
|
|
'dbQueries' => $dbQueries |
822
|
|
|
]; |
823
|
|
|
|
824
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
825
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__ . 'PreInsert', $variables); |
826
|
|
|
|
827
|
|
|
$query = $db->INSERTquery($variables['table'], $variables['configurationRow']); |
828
|
|
|
$db->admin_query($query); |
829
|
|
|
$dbQueries[] = $query; |
830
|
|
|
$recordId = $db->sql_insert_id(); |
831
|
|
|
|
832
|
|
|
$variables = [ |
833
|
|
|
'table' => $variables['table'], |
834
|
|
|
'configurationRow' => $configurationRow, |
835
|
|
|
'calEventRow' => $calEventRow, |
836
|
|
|
'recordId' => $recordId, |
837
|
|
|
'dbQueries' => $dbQueries |
838
|
|
|
]; |
839
|
|
|
|
840
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
841
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__ . 'PostInsert', $variables); |
842
|
|
|
|
843
|
|
|
return $variables['recordId']; |
844
|
|
|
|
845
|
|
|
/* |
846
|
|
|
* |
847
|
|
|
* @todo |
848
|
|
|
|
849
|
|
|
recurrence text NULL |
850
|
|
|
day text NULL |
851
|
|
|
|
852
|
|
|
|
853
|
|
|
* ["freq"]=> |
854
|
|
|
* string(4) "none" |
855
|
|
|
* ["until"]=> |
856
|
|
|
* string(1) "0" |
857
|
|
|
* ["cnt"]=> |
858
|
|
|
* string(1) "0" |
859
|
|
|
* ["byday"]=> |
860
|
|
|
* string(0) "" |
861
|
|
|
* ["bymonthday"]=> |
862
|
|
|
* string(0) "" |
863
|
|
|
* ["bymonth"]=> |
864
|
|
|
* string(0) "" |
865
|
|
|
* ["intrval"]=> |
866
|
|
|
* string(1) "1" |
867
|
|
|
* ["rdate"]=> |
868
|
|
|
* NULL |
869
|
|
|
* ["rdate_type"]=> |
870
|
|
|
* string(1) "0" |
871
|
|
|
* ["deviation"]=> |
872
|
|
|
* string(1) "0" |
873
|
|
|
* ["monitor_cnt"]=> |
874
|
|
|
* string(1) "0" |
875
|
|
|
* ["exception_cnt"]=> |
876
|
|
|
*/ |
877
|
|
|
} |
878
|
|
|
|
879
|
|
|
/** |
880
|
|
|
* @param $oldFormat |
881
|
|
|
* |
882
|
|
|
* @return int|string |
883
|
|
|
*/ |
884
|
|
|
protected function migrateDate($oldFormat) |
885
|
|
|
{ |
886
|
|
|
try { |
887
|
|
|
$date = new \DateTime($oldFormat); |
888
|
|
|
return $date->getTimestamp(); |
889
|
|
|
} catch (\Exception $e) { |
|
|
|
|
890
|
|
|
} |
891
|
|
|
return ''; |
892
|
|
|
} |
893
|
|
|
|
894
|
|
|
/** |
895
|
|
|
* Get the non migrated cal IDs |
896
|
|
|
* |
897
|
|
|
* @return array |
898
|
|
|
*/ |
899
|
|
|
protected function getNonMigratedCalIds() |
900
|
|
|
{ |
901
|
|
|
if (!ExtensionManagementUtility::isLoaded('cal')) { |
902
|
|
|
return []; |
903
|
|
|
} |
904
|
|
|
|
905
|
|
|
$db = HelperUtility::getDatabaseConnection(); |
906
|
|
|
$checkImportIds = []; |
907
|
|
|
$nonMigrated = []; |
908
|
|
|
$events = $db->exec_SELECTgetRows('uid', 'tx_cal_event', '1=1' . BackendUtility::deleteClause('tx_cal_event')); |
909
|
|
|
|
910
|
|
|
foreach ($events as $event) { |
|
|
|
|
911
|
|
|
$checkImportIds[] = '"' . self::IMPORT_PREFIX . $event['uid'] . '"'; |
912
|
|
|
$nonMigrated[(int)$event['uid']] = (int)$event['uid']; |
913
|
|
|
} |
914
|
|
|
|
915
|
|
|
$countOriginal = count($checkImportIds); |
916
|
|
|
if ($countOriginal === 0) { |
917
|
|
|
return []; |
918
|
|
|
} |
919
|
|
|
|
920
|
|
|
$variables = [ |
921
|
|
|
'table' => self::EVENT_TABLE |
922
|
|
|
]; |
923
|
|
|
|
924
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
925
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__ . 'PreSelect', $variables); |
926
|
|
|
|
927
|
|
|
$migratedRows = $db->exec_SELECTgetRows( |
928
|
|
|
'uid,import_id', |
929
|
|
|
$variables['table'], |
930
|
|
|
'import_id IN (' . implode(',', $checkImportIds) . ')' . BackendUtility::deleteClause($variables['table']) |
931
|
|
|
); |
932
|
|
|
|
933
|
|
|
foreach ($migratedRows as $migratedRow) { |
|
|
|
|
934
|
|
|
$importId = (int)str_replace(self::IMPORT_PREFIX, '', $migratedRow['import_id']); |
935
|
|
|
if (isset($nonMigrated[$importId])) { |
936
|
|
|
unset($nonMigrated[$importId]); |
937
|
|
|
} |
938
|
|
|
} |
939
|
|
|
|
940
|
|
|
$variables = [ |
941
|
|
|
'table' => $variables['table'], |
942
|
|
|
'migratedRows' => $migratedRows, |
943
|
|
|
'nonMigrated' => $nonMigrated |
944
|
|
|
]; |
945
|
|
|
|
946
|
|
|
$dispatcher = HelperUtility::getSignalSlotDispatcher(); |
947
|
|
|
$variables = $dispatcher->dispatch(__CLASS__, __FUNCTION__ . 'ReadyParsed', $variables); |
948
|
|
|
|
949
|
|
|
return $variables['nonMigrated']; |
950
|
|
|
} |
951
|
|
|
} |
952
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.