‪TYPO3CMS  10.4
FormFileExtensionUpdate.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 namespace ‪TYPO3\CMS\Form\Hooks;
19 
20 use Symfony\Component\Console\Output\OutputInterface;
40 
46 {
50  protected ‪$output;
51 
55  protected ‪$persistenceManager;
56 
60  protected ‪$resourceFactory;
61 
65  protected ‪$referenceIndex;
66 
70  protected ‪$flexFormTools;
71 
75  protected ‪$connection;
76 
83  public function ‪getIdentifier(): string
84  {
85  return 'formFileExtension';
86  }
87 
93  public function ‪getTitle(): string
94  {
95  return 'Rename form definition file extension from .yaml to .form.yaml';
96  }
97 
103  public function ‪getDescription(): string
104  {
105  return 'Form definition files need to be named *.form.yaml to have a way of distinguishing form yaml ' .
106  'configuration files from other yaml configuration files. This wizard will analyze and rename found files.';
107  }
108 
116  public function ‪getPrerequisites(): array
117  {
118  return [
119  ReferenceIndexUpdatedPrerequisite::class,
120  DatabaseUpdatedPrerequisite::class
121  ];
122  }
123 
124  public function ‪setOutput(OutputInterface ‪$output): void
125  {
126  $this->output = ‪$output;
127  }
128 
134  public function ‪updateNecessary(): bool
135  {
136  $updateNeeded = false;
137 
138  $this->persistenceManager = $this->‪getObjectManager()->‪get(FormPersistenceManager::class);
139  $this->resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
140 
141  foreach ($this->‪getFormDefinitionsInformation() as $formDefinitionInformation) {
142  if (
143  (
144  $formDefinitionInformation['hasNewFileExtension'] === true
145  && $formDefinitionInformation['hasReferencesForOldFileExtension'] === false
146  && $formDefinitionInformation['hasReferencesForNewFileExtension'] === false
147  )
148  || (
149  $formDefinitionInformation['hasNewFileExtension'] === false
150  && $formDefinitionInformation['location'] === 'extension'
151  && $formDefinitionInformation['hasReferencesForOldFileExtension'] === false
152  && $formDefinitionInformation['hasReferencesForNewFileExtension'] === false
153  )
154  ) {
155  continue;
156  }
157 
158  if (
159  $formDefinitionInformation['hasNewFileExtension'] === false
160  && $formDefinitionInformation['location'] === 'storage'
161  ) {
162  $updateNeeded = true;
163  $this->output->writeln('Form definition files were found that should be migrated to be named .form.yaml.');
164  }
165 
166  if (
167  $formDefinitionInformation['hasNewFileExtension']
168  && $formDefinitionInformation['hasReferencesForOldFileExtension']
169  ) {
170  $updateNeeded = true;
171  $this->output->writeln('Referenced form definition files found that should be updated.');
172  }
173 
174  if (
175  $formDefinitionInformation['referencesForOldFileExtensionNeedsFlexformUpdates'] === true
176  || $formDefinitionInformation['referencesForNewFileExtensionNeedsFlexformUpdates'] === true
177  ) {
178  $updateNeeded = true;
179  if ($formDefinitionInformation['hasNewFileExtension'] === true) {
180  $this->output->writeln('Referenced form definition files found that should be updated.');
181  } elseif ($formDefinitionInformation['location'] === 'storage') {
182  $this->output->writeln('Referenced form definition files found that should be updated.');
183  } else {
184  $this->output->writeln(
185  '<warning>There are references to form definitions which are located in extensions and thus cannot be renamed automatically by this wizard.'
186  . 'This form definitions from extensions that do not end with .form.yaml have to be renamed by hand!'
187  . 'After that you can run this wizard again to migrate the references.</warning>'
188  );
189  }
190  }
191  }
192 
193  return $updateNeeded;
194  }
195 
201  public function ‪executeUpdate(): bool
202  {
203  $success = true;
204 
205  ‪$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
206  $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
207  $filePersistenceSlot = GeneralUtility::makeInstance(FilePersistenceSlot::class);
208 
209  $this->connection = $connectionPool->getConnectionForTable('tt_content');
210  $this->persistenceManager = $this->‪getObjectManager()->‪get(FormPersistenceManager::class);
211  $this->resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
212  $this->referenceIndex = GeneralUtility::makeInstance(ReferenceIndex::class);
213  $this->flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
214 
215  $filePersistenceSlot->defineInvocation(
217  true
218  );
219 
220  $formDefinitionsInformation = $this->‪getFormDefinitionsInformation();
221  foreach ($formDefinitionsInformation as $currentPersistenceIdentifier => $formDefinitionInformation) {
222  if (
223  (
224  $formDefinitionInformation['hasNewFileExtension'] === true
225  && $formDefinitionInformation['hasReferencesForOldFileExtension'] === false
226  && $formDefinitionInformation['hasReferencesForNewFileExtension'] === false
227  )
228  || (
229  $formDefinitionInformation['hasNewFileExtension'] === false
230  && $formDefinitionInformation['location'] === 'extension'
231  && $formDefinitionInformation['hasReferencesForOldFileExtension'] === false
232  && $formDefinitionInformation['hasReferencesForNewFileExtension'] === false
233  )
234  ) {
235  continue;
236  }
237 
238  if (
239  $formDefinitionInformation['hasNewFileExtension'] === true
240  && (
241  $formDefinitionInformation['hasReferencesForOldFileExtension'] === true
242  || $formDefinitionInformation['hasReferencesForNewFileExtension'] === true
243  )
244  ) {
245  foreach ($formDefinitionInformation['referencesForOldFileExtension'] as $referenceForOldFileExtension) {
246  $newFlexformXml = $this->‪generateNewFlexformForReference(
247  $referenceForOldFileExtension,
248  $referenceForOldFileExtension['sheetIdentifiersWhichNeedsUpdate'],
249  $formDefinitionInformation['persistenceIdentifier']
250  );
252  $referenceForOldFileExtension['ttContentUid'],
253  $newFlexformXml,
254  true
255  );
256  }
257 
258  foreach ($formDefinitionInformation['referencesForNewFileExtension'] as $referenceForNewFileExtension) {
259  $newFlexformXml = $this->‪generateNewFlexformForReference(
260  $referenceForNewFileExtension,
261  $referenceForNewFileExtension['sheetIdentifiersWhichNeedsUpdate']
262  );
264  $referenceForNewFileExtension['ttContentUid'],
265  $newFlexformXml
266  );
267  }
268 
269  continue;
270  }
271 
272  if ($formDefinitionInformation['location'] === 'storage') {
273  $file = $formDefinitionInformation['file'];
274 
275  $newPossiblePersistenceIdentifier = $this->persistenceManager->getUniquePersistenceIdentifier(
276  $file->getNameWithoutExtension(),
277  $file->getParentFolder()->getCombinedIdentifier()
278  );
279  $newFileName = ‪PathUtility::pathinfo(
280  $newPossiblePersistenceIdentifier,
281  PATHINFO_BASENAME
282  );
283  $newFileName = is_string($newFileName) ? $newFileName : '';
284 
285  try {
286  $file->rename($newFileName, ‪DuplicationBehavior::RENAME);
287  $newPersistenceIdentifier = $file->getCombinedIdentifier();
288  } catch (\‪Exception $e) {
289  $this->output->writeln(sprintf(
290  '<error>Failed to rename form definition "%s" to "%s".</error>',
291  $formDefinitionInformation['persistenceIdentifier'],
292  $newFileName
293  ));
294  $success = false;
295  continue;
296  }
297 
298  if (
299  $formDefinitionInformation['hasReferencesForOldFileExtension'] === true
300  || $formDefinitionInformation['hasReferencesForNewFileExtension'] === true
301  ) {
302  foreach ($formDefinitionInformation['referencesForOldFileExtension'] as $referenceForOldFileExtension) {
303  $sheetIdentifiersWhichNeedsUpdate = $this->‪getSheetIdentifiersWhichNeedsUpdate(
304  $referenceForOldFileExtension['flexform'],
305  $formDefinitionsInformation,
306  $currentPersistenceIdentifier,
307  $formDefinitionInformation['persistenceIdentifier'],
308  $newPersistenceIdentifier
309  );
310  $newFlexformXml = $this->‪generateNewFlexformForReference(
311  $referenceForOldFileExtension,
312  $sheetIdentifiersWhichNeedsUpdate,
313  $newPersistenceIdentifier
314  );
316  $referenceForOldFileExtension['ttContentUid'],
317  $newFlexformXml
318  );
319  }
320 
321  foreach ($formDefinitionInformation['referencesForNewFileExtension'] as $referenceForNewFileExtension) {
322  $sheetIdentifiersWhichNeedsUpdate = $this->‪getSheetIdentifiersWhichNeedsUpdate(
323  $referenceForNewFileExtension['flexform'],
324  $formDefinitionsInformation,
325  $currentPersistenceIdentifier,
326  $formDefinitionInformation['persistenceIdentifier'],
327  $newPersistenceIdentifier
328  );
329  $newFlexformXml = $this->‪generateNewFlexformForReference(
330  $referenceForNewFileExtension,
331  $sheetIdentifiersWhichNeedsUpdate,
332  $newPersistenceIdentifier
333  );
335  $referenceForNewFileExtension['ttContentUid'],
336  $newFlexformXml
337  );
338  }
339  }
340  } else {
341  $success = false;
342  $this->output->writeln(sprintf(
343  '<error>Failed to rename form definition "%s" to "%s". You have to be rename it by hand!. '
344  . 'After that you can run this wizard again to migrate the references.</error>',
345  $formDefinitionInformation['persistenceIdentifier'],
346  $this->‪getNewPersistenceIdentifier($formDefinitionInformation['persistenceIdentifier'])
347  ));
348  }
349  }
350 
351  $filePersistenceSlot->defineInvocation(
353  null
354  );
355 
356  return $success;
357  }
358 
362  protected function ‪getFormDefinitionsInformation(): array
363  {
364  $formDefinitionsInformation = array_merge(
367  );
368 
369  $formDefinitionsInformation = $this->‪enrichFormDefinitionsInformationWithDataFromReferences($formDefinitionsInformation);
370 
371  return $formDefinitionsInformation;
372  }
373 
377  protected function ‪getFormDefinitionsInformationFromStorages(): array
378  {
379  $formDefinitionsInformation = [];
380 
381  foreach ($this->persistenceManager->retrieveYamlFilesFromStorageFolders() as $file) {
382  $persistenceIdentifier = $file->getCombinedIdentifier();
383 
384  $formDefinition = $this->‪getFormDefinition($file);
385  if (empty($formDefinition)) {
386  continue;
387  }
388 
389  $formDefinitionsInformation[$persistenceIdentifier] = $this->‪setFormDefinitionInformationData(
390  $persistenceIdentifier,
391  $formDefinition,
392  $file,
393  'storage'
394  );
395  }
396 
397  return $formDefinitionsInformation;
398  }
399 
403  protected function ‪getFormDefinitionsInformationFromExtensions(): array
404  {
405  $formDefinitionsInformation = [];
406 
407  foreach ($this->persistenceManager->retrieveYamlFilesFromExtensionFolders() as $persistenceIdentifier => $_) {
408  try {
410  $file = $this->resourceFactory->retrieveFileOrFolderObject($persistenceIdentifier);
411  } catch (\‪Exception $exception) {
412  continue;
413  }
414 
415  $formDefinition = $this->‪getFormDefinition($file);
416  if (empty($formDefinition)) {
417  continue;
418  }
419 
420  $formDefinitionsInformation[$persistenceIdentifier] = $this->‪setFormDefinitionInformationData(
421  $persistenceIdentifier,
422  $formDefinition,
423  $file,
424  'extension'
425  );
426  }
427 
428  return $formDefinitionsInformation;
429  }
430 
438  protected function ‪setFormDefinitionInformationData(
439  string $persistenceIdentifier,
440  array $formDefinition,
441  File $file,
442  string $location
443  ): array {
444  return [
445  'location' => $location,
446  'persistenceIdentifier' => $persistenceIdentifier,
447  'prototypeName' => $formDefinition['prototypeName'],
448  'formIdentifier' => $formDefinition['identifier'],
449  'file' => $file,
450  'referencesForOldFileExtension' => [],
451  'referencesForNewFileExtension' => [],
452  'hasNewFileExtension' => $this->‪hasNewFileExtension($persistenceIdentifier),
453  'hasReferencesForOldFileExtension' => false,
454  'hasReferencesForNewFileExtension' => false,
455  'referencesForOldFileExtensionNeedsFlexformUpdates' => false,
456  'referencesForNewFileExtensionNeedsFlexformUpdates' => false,
457  ];
458  }
459 
464  protected function ‪enrichFormDefinitionsInformationWithDataFromReferences(array $formDefinitionsInformation): array
465  {
466  foreach ($this->‪getAllFlexformFieldsFromFormPlugins() as $pluginData) {
467  if (empty($pluginData['pi_flexform'])) {
468  continue;
469  }
470  $flexform = ‪GeneralUtility::xml2array($pluginData['pi_flexform']);
471  if (!is_array($flexform)) {
472  // * There is no data other than a base XML-structure in pi_flexform:
473  // xml2array returns empty string or newline-character (string)
474  // * pi_flexform is invalid XML:
475  // xml2array returns an error message (string)
476  continue;
477  }
478  $referencedPersistenceIdentifier = $this->‪getPersistenceIdentifierFromFlexform($flexform);
479  $referenceHasNewFileExtension = $this->‪hasNewFileExtension($referencedPersistenceIdentifier);
480  $possibleOldReferencedPersistenceIdentifier = $this->‪getOldPersistenceIdentifier($referencedPersistenceIdentifier);
481  $possibleNewReferencedPersistenceIdentifier = $this->‪getNewPersistenceIdentifier($referencedPersistenceIdentifier);
482 
483  $referenceData = [
484  'scope' => null,
485  'ttContentUid' => (int)$pluginData['uid'],
486  'flexform' => $flexform,
487  'sheetIdentifiersWhichNeedsUpdate' => [],
488  ];
489 
490  $targetPersistenceIdentifier = null;
491  if (array_key_exists($referencedPersistenceIdentifier, $formDefinitionsInformation)) {
492  $targetPersistenceIdentifier = $referencedPersistenceIdentifier;
493  if ($referenceHasNewFileExtension) {
494  $referenceData['scope'] = 'referencesForNewFileExtension';
495  } else {
496  $referenceData['scope'] = 'referencesForOldFileExtension';
497  }
498  } else {
499  if ($referenceHasNewFileExtension) {
500  if (array_key_exists($possibleOldReferencedPersistenceIdentifier, $formDefinitionsInformation)) {
501  $targetPersistenceIdentifier = $possibleOldReferencedPersistenceIdentifier;
502  $referenceData['scope'] = 'referencesForNewFileExtension';
503  } else {
504  // There is no existing file for this reference
505  continue;
506  }
507  } else {
508  if (array_key_exists($possibleNewReferencedPersistenceIdentifier, $formDefinitionsInformation)) {
509  $targetPersistenceIdentifier = $possibleNewReferencedPersistenceIdentifier;
510  $referenceData['scope'] = 'referencesForOldFileExtension';
511  } else {
512  // There is no existing file for this reference
513  continue;
514  }
515  }
516  }
517 
518  $referenceData['sheetIdentifiersWhichNeedsUpdate'] = $this->‪getSheetIdentifiersWhichNeedsUpdate(
519  $flexform,
520  $formDefinitionsInformation,
521  $targetPersistenceIdentifier,
522  $possibleOldReferencedPersistenceIdentifier,
523  $possibleNewReferencedPersistenceIdentifier
524  );
525 
526  $scope = $referenceData['scope'];
527 
528  $formDefinitionsInformation[$targetPersistenceIdentifier][$scope][] = $referenceData;
529  if ($scope === 'referencesForOldFileExtension') {
530  $formDefinitionsInformation[$targetPersistenceIdentifier]['hasReferencesForOldFileExtension'] = true;
531  $formDefinitionsInformation[$targetPersistenceIdentifier]['referencesForOldFileExtensionNeedsFlexformUpdates'] = !empty($referenceData['sheetIdentifiersWhichNeedsUpdate']);
532  } else {
533  $formDefinitionsInformation[$targetPersistenceIdentifier]['hasReferencesForNewFileExtension'] = true;
534  $formDefinitionsInformation[$targetPersistenceIdentifier]['referencesForNewFileExtensionNeedsFlexformUpdates'] = !empty($referenceData['sheetIdentifiersWhichNeedsUpdate']);
535  }
536  }
537 
538  return $formDefinitionsInformation;
539  }
540 
549  protected function ‪getSheetIdentifiersWhichNeedsUpdate(
550  array $flexform,
551  array $formDefinitionsInformation,
552  string $targetPersistenceIdentifier,
553  string $possibleOldReferencedPersistenceIdentifier,
554  string $possibleNewReferencedPersistenceIdentifier
555  ): array {
556  $sheetIdentifiersWhichNeedsUpdate = [];
557 
558  $sheetIdentifiers = $this->‪getSheetIdentifiersForFinisherOverrides($flexform);
559  foreach ($sheetIdentifiers as $currentSheetIdentifier => $finisherIdentifier) {
560  $sheetIdentifierForOldPersistenceIdentifier = $this->‪buildExpectedSheetIdentifier(
561  $possibleOldReferencedPersistenceIdentifier,
562  $formDefinitionsInformation[$targetPersistenceIdentifier]['prototypeName'],
563  $formDefinitionsInformation[$targetPersistenceIdentifier]['formIdentifier'],
564  $finisherIdentifier
565  );
566 
567  $sheetIdentifierForNewPersistenceIdentifier = $this->‪buildExpectedSheetIdentifier(
568  $possibleNewReferencedPersistenceIdentifier,
569  $formDefinitionsInformation[$targetPersistenceIdentifier]['prototypeName'],
570  $formDefinitionsInformation[$targetPersistenceIdentifier]['formIdentifier'],
571  $finisherIdentifier
572  );
573 
574  if (
575  $currentSheetIdentifier === $sheetIdentifierForOldPersistenceIdentifier
576  && !array_key_exists($sheetIdentifierForNewPersistenceIdentifier, $sheetIdentifiers)
577  ) {
578  $sheetIdentifiersWhichNeedsUpdate[$currentSheetIdentifier] = $sheetIdentifierForNewPersistenceIdentifier;
579  }
580  }
581 
582  return $sheetIdentifiersWhichNeedsUpdate;
583  }
584 
589  protected function ‪getSheetIdentifiersForFinisherOverrides(array $flexform): array
590  {
591  $sheetIdentifiers = [];
592  foreach ($this->‪getFinisherSheetsFromFlexform($flexform) as $sheetIdentifier => $sheetData) {
593  $itemOptionPath = array_keys($sheetData['lDEF']);
594  $firstSheetItemOptionPath = (string)array_shift($itemOptionPath);
595  preg_match('#^settings\.finishers\.(.*)\..+$#', $firstSheetItemOptionPath, $matches);
596  if (!isset($matches[1])) {
597  continue;
598  }
599  $sheetIdentifiers[$sheetIdentifier] = $matches[1];
600  }
601 
602  return $sheetIdentifiers;
603  }
604 
609  protected function ‪getFinisherSheetsFromFlexform(array $flexform): array
610  {
611  if (!isset($flexform['data'])) {
612  return [];
613  }
614 
615  return array_filter(
616  $flexform['data'],
617  function ($key) {
618  return $key !== 'sDEF' && strlen($key) === 32;
619  },
620  ARRAY_FILTER_USE_KEY
621  );
622  }
623 
628  protected function ‪getPersistenceIdentifierFromFlexform(array $flexform): string
629  {
630  return $flexform['data']['sDEF']['lDEF']['settings.persistenceIdentifier']['vDEF'] ?? '';
631  }
632 
639  protected function ‪generateNewFlexformForReference(
640  array $referenceData,
641  array $sheetIdentifiersWhichNeedsUpdate,
642  string $newPersistenceIdentifier = ''
643  ): string {
644  $flexform = $referenceData['flexform'];
645  if (!empty($newPersistenceIdentifier)) {
646  $flexform['data']['sDEF']['lDEF']['settings.persistenceIdentifier']['vDEF'] = $newPersistenceIdentifier;
647  }
648 
649  foreach ($sheetIdentifiersWhichNeedsUpdate as $oldSheetIdentifier => $newSheetIdentifier) {
650  $flexform['data'][$newSheetIdentifier] = $flexform['data'][$oldSheetIdentifier];
651  unset($flexform['data'][$oldSheetIdentifier]);
652  }
653 
654  return $this->flexFormTools->flexArray2Xml($flexform, true);
655  }
656 
661  protected function ‪hasNewFileExtension(string $persistenceIdentifier): bool
662  {
664  $persistenceIdentifier,
666  );
667  }
668 
673  protected function ‪looksLikeAFormDefinition(array $formDefinition): bool
674  {
675  return isset($formDefinition['identifier'], $formDefinition['type']) && $formDefinition['type'] === 'Form';
676  }
677 
682  protected function ‪getOldPersistenceIdentifier(string $persistenceIdentifier): string
683  {
684  return preg_replace(
685  '
686  #^(.*)(\.form\.yaml)$#',
687  '${1}.yaml',
688  $persistenceIdentifier
689  );
690  }
691 
696  protected function ‪getNewPersistenceIdentifier(string $persistenceIdentifier): string
697  {
698  return preg_replace(
699  '#(?<!\.form).yaml$#',
700  '.form.yaml',
701  $persistenceIdentifier
702  );
703  }
704 
712  protected function ‪buildExpectedSheetIdentifier(
713  string $persistenceIdentifier,
714  string $prototypeName,
715  string $formIdentifier,
716  string $finisherIdentifier
717  ): string {
718  return md5(
719  implode('', [
720  $persistenceIdentifier,
721  $prototypeName,
722  $formIdentifier,
723  $finisherIdentifier
724  ])
725  );
726  }
727 
732  protected function ‪getFormDefinition(‪File $file): array
733  {
734  try {
735  $rawYamlContent = $file->‪getContents();
736  $formDefinition = $this->‪extractMetaDataFromCouldBeFormDefinition($rawYamlContent);
737 
738  if (!$this->‪looksLikeAFormDefinition($formDefinition)) {
739  $formDefinition = [];
740  }
741  } catch (\‪Exception $exception) {
742  $formDefinition = [];
743  }
744 
745  return $formDefinition;
746  }
747 
752  protected function ‪extractMetaDataFromCouldBeFormDefinition(string $maybeRawFormDefinition): array
753  {
754  $metaDataProperties = ['identifier', 'type', 'label', 'prototypeName'];
755  $metaData = [];
756  foreach (explode("\n", $maybeRawFormDefinition) as $line) {
757  if (empty($line) || $line[0] === ' ') {
758  continue;
759  }
760 
761  [$key, $value] = explode(':', $line);
762  if (
763  empty($key)
764  || empty($value)
765  || !in_array($key, $metaDataProperties)
766  ) {
767  continue;
768  }
769 
770  $value = trim($value, ' \'"');
771  $metaData[$key] = $value;
772  }
773 
774  return $metaData;
775  }
776 
780  protected function ‪getAllFlexformFieldsFromFormPlugins(): array
781  {
782  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
783  ->getQueryBuilderForTable('tt_content');
784  $queryBuilder->getRestrictions()
785  ->removeAll()
786  ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
787 
788  $records = $queryBuilder
789  ->select('uid', 'pi_flexform')
790  ->from('tt_content')
791  ->where(
792  $queryBuilder->expr()->eq(
793  'CType',
794  $queryBuilder->createNamedParameter('form_formframework', \PDO::PARAM_STR)
795  )
796  )
797  ->execute()
798  ->fetchAll();
799 
800  return $records;
801  }
802 
808  protected function ‪updateContentReference(
809  int $uid,
810  string $flexform,
811  bool $updateRefindex = false
812  ): void {
813  $this->connection->update(
814  'tt_content',
815  ['pi_flexform' => $flexform],
816  ['uid' => $uid]
817  );
818 
819  if (!$updateRefindex) {
820  return;
821  }
822 
823  $this->referenceIndex->updateRefIndexTable(
824  'tt_content',
825  $uid
826  );
827  }
828 
832  protected function ‪getObjectManager(): ‪ObjectManager
833  {
834  return GeneralUtility::makeInstance(ObjectManager::class);
835  }
836 }
‪TYPO3\CMS\Core\Utility\GeneralUtility\xml2array
‪static mixed xml2array($string, $NSprefix='', $reportDocTag=false)
Definition: GeneralUtility.php:1531
‪TYPO3\CMS\Core\Utility\PathUtility
Definition: PathUtility.php:24
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFormDefinition
‪array getFormDefinition(File $file)
Definition: FormFileExtensionUpdate.php:726
‪TYPO3\CMS\Core\Resource\DuplicationBehavior
Definition: DuplicationBehavior.php:24
‪TYPO3\CMS\Core\Utility\StringUtility\endsWith
‪static bool endsWith($haystack, $needle)
Definition: StringUtility.php:61
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFormDefinitionsInformationFromExtensions
‪array getFormDefinitionsInformationFromExtensions()
Definition: FormFileExtensionUpdate.php:397
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$referenceIndex
‪ReferenceIndex $referenceIndex
Definition: FormFileExtensionUpdate.php:61
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$output
‪OutputInterface $output
Definition: FormFileExtensionUpdate.php:49
‪TYPO3\CMS\Core\Database\ReferenceIndex
Definition: ReferenceIndex.php:48
‪TYPO3\CMS\Install\Updates\ChattyInterface
Definition: ChattyInterface.php:26
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getDescription
‪string getDescription()
Definition: FormFileExtensionUpdate.php:97
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\hasNewFileExtension
‪bool hasNewFileExtension(string $persistenceIdentifier)
Definition: FormFileExtensionUpdate.php:655
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getSheetIdentifiersForFinisherOverrides
‪array getSheetIdentifiersForFinisherOverrides(array $flexform)
Definition: FormFileExtensionUpdate.php:583
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$persistenceManager
‪FormPersistenceManager $persistenceManager
Definition: FormFileExtensionUpdate.php:53
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getOldPersistenceIdentifier
‪string getOldPersistenceIdentifier(string $persistenceIdentifier)
Definition: FormFileExtensionUpdate.php:676
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\setFormDefinitionInformationData
‪array setFormDefinitionInformationData(string $persistenceIdentifier, array $formDefinition, File $file, string $location)
Definition: FormFileExtensionUpdate.php:432
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFinisherSheetsFromFlexform
‪array getFinisherSheetsFromFlexform(array $flexform)
Definition: FormFileExtensionUpdate.php:603
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite
Definition: DatabaseUpdatedPrerequisite.php:29
‪TYPO3\CMS\Form\Exception
Definition: Exception.php:26
‪TYPO3\CMS\Form\Hooks
Definition: DataStructureIdentifierHook.php:18
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$flexFormTools
‪FlexFormTools $flexFormTools
Definition: FormFileExtensionUpdate.php:65
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\updateNecessary
‪bool updateNecessary()
Definition: FormFileExtensionUpdate.php:128
‪TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager
Definition: FormPersistenceManager.php:54
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\enrichFormDefinitionsInformationWithDataFromReferences
‪array enrichFormDefinitionsInformationWithDataFromReferences(array $formDefinitionsInformation)
Definition: FormFileExtensionUpdate.php:458
‪TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools
Definition: FlexFormTools.php:38
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$resourceFactory
‪ResourceFactory $resourceFactory
Definition: FormFileExtensionUpdate.php:57
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:41
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\extractMetaDataFromCouldBeFormDefinition
‪array extractMetaDataFromCouldBeFormDefinition(string $maybeRawFormDefinition)
Definition: FormFileExtensionUpdate.php:746
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\generateNewFlexformForReference
‪string generateNewFlexformForReference(array $referenceData, array $sheetIdentifiersWhichNeedsUpdate, string $newPersistenceIdentifier='')
Definition: FormFileExtensionUpdate.php:633
‪TYPO3\CMS\Core\Resource\File
Definition: File.php:24
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getNewPersistenceIdentifier
‪string getNewPersistenceIdentifier(string $persistenceIdentifier)
Definition: FormFileExtensionUpdate.php:690
‪TYPO3\CMS\Core\Resource\DuplicationBehavior\RENAME
‪const RENAME
Definition: DuplicationBehavior.php:32
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\setOutput
‪setOutput(OutputInterface $output)
Definition: FormFileExtensionUpdate.php:118
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\executeUpdate
‪bool executeUpdate()
Definition: FormFileExtensionUpdate.php:195
‪TYPO3\CMS\Core\Utility\PathUtility\pathinfo
‪static string string[] pathinfo($path, $options=null)
Definition: PathUtility.php:208
‪TYPO3\CMS\Core\Error\Exception
Definition: Exception.php:22
‪TYPO3\CMS\Form\Slot\FilePersistenceSlot
Definition: FilePersistenceSlot.php:38
‪TYPO3\CMS\Core\Resource\File\getContents
‪string getContents()
Definition: File.php:128
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\updateContentReference
‪updateContentReference(int $uid, string $flexform, bool $updateRefindex=false)
Definition: FormFileExtensionUpdate.php:802
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getObjectManager
‪ObjectManager getObjectManager()
Definition: FormFileExtensionUpdate.php:826
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getPersistenceIdentifierFromFlexform
‪string getPersistenceIdentifierFromFlexform(array $flexform)
Definition: FormFileExtensionUpdate.php:622
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:36
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getSheetIdentifiersWhichNeedsUpdate
‪array getSheetIdentifiersWhichNeedsUpdate(array $flexform, array $formDefinitionsInformation, string $targetPersistenceIdentifier, string $possibleOldReferencedPersistenceIdentifier, string $possibleNewReferencedPersistenceIdentifier)
Definition: FormFileExtensionUpdate.php:543
‪TYPO3\CMS\Install\Updates\UpgradeWizardInterface
Definition: UpgradeWizardInterface.php:24
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getAllFlexformFieldsFromFormPlugins
‪array getAllFlexformFieldsFromFormPlugins()
Definition: FormFileExtensionUpdate.php:774
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:28
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\buildExpectedSheetIdentifier
‪string buildExpectedSheetIdentifier(string $persistenceIdentifier, string $prototypeName, string $formIdentifier, string $finisherIdentifier)
Definition: FormFileExtensionUpdate.php:706
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getPrerequisites
‪string[] getPrerequisites()
Definition: FormFileExtensionUpdate.php:110
‪TYPO3\CMS\Extbase\Object\ObjectManager\get
‪object &T get(string $className,... $constructorArguments)
Definition: ObjectManager.php:97
‪TYPO3\CMS\Form\Slot\FilePersistenceSlot\COMMAND_FILE_RENAME
‪const COMMAND_FILE_RENAME
Definition: FilePersistenceSlot.php:42
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$connection
‪Connection $connection
Definition: FormFileExtensionUpdate.php:69
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFormDefinitionsInformation
‪array getFormDefinitionsInformation()
Definition: FormFileExtensionUpdate.php:356
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate
Definition: FormFileExtensionUpdate.php:46
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFormDefinitionsInformationFromStorages
‪array getFormDefinitionsInformationFromStorages()
Definition: FormFileExtensionUpdate.php:371
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getIdentifier
‪string getIdentifier()
Definition: FormFileExtensionUpdate.php:77
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:22
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite
Definition: ReferenceIndexUpdatedPrerequisite.php:35
‪TYPO3\CMS\Extbase\Object\ObjectManager
Definition: ObjectManager.php:28
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getTitle
‪string getTitle()
Definition: FormFileExtensionUpdate.php:87
‪TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager\FORM_DEFINITION_FILE_EXTENSION
‪const FORM_DEFINITION_FILE_EXTENSION
Definition: FormPersistenceManager.php:55
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\looksLikeAFormDefinition
‪bool looksLikeAFormDefinition(array $formDefinition)
Definition: FormFileExtensionUpdate.php:667