‪TYPO3CMS  9.5
FormFileExtensionUpdate.php
Go to the documentation of this file.
1 <?php
2 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 use Symfony\Component\Console\Output\OutputInterface;
38 
44 {
48  protected ‪$output;
49 
53  protected ‪$persistenceManager;
54 
58  protected ‪$resourceFactory;
59 
63  protected ‪$referenceIndex;
64 
68  protected ‪$flexFormTools;
69 
73  protected ‪$connection;
74 
81  public function ‪getIdentifier(): string
82  {
83  return 'formFileExtension';
84  }
85 
91  public function ‪getTitle(): string
92  {
93  return 'Rename form definition file extension from .yaml to .form.yaml';
94  }
95 
101  public function ‪getDescription(): string
102  {
103  return 'Form definition files need to be named *.form.yaml to have a way of distinguishing form yaml ' .
104  'configuration files from other yaml configuration files. This wizard will analyze and rename found files.';
105  }
106 
114  public function ‪getPrerequisites(): array
115  {
116  return [
117  ReferenceIndexUpdatedPrerequisite::class,
118  DatabaseUpdatedPrerequisite::class
119  ];
120  }
121 
122  public function ‪setOutput(OutputInterface ‪$output): void
123  {
124  $this->output = ‪$output;
125  }
126 
132  public function ‪updateNecessary(): bool
133  {
134  $updateNeeded = false;
135 
136  $this->persistenceManager = $this->‪getObjectManager()->‪get(FormPersistenceManager::class);
137  $this->resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
138 
139  foreach ($this->‪getFormDefinitionsInformation() as $formDefinitionInformation) {
140  if (
141  (
142  $formDefinitionInformation['hasNewFileExtension'] === true
143  && $formDefinitionInformation['hasReferencesForOldFileExtension'] === false
144  && $formDefinitionInformation['hasReferencesForNewFileExtension'] === false
145  )
146  || (
147  $formDefinitionInformation['hasNewFileExtension'] === false
148  && $formDefinitionInformation['location'] === 'extension'
149  && $formDefinitionInformation['hasReferencesForOldFileExtension'] === false
150  && $formDefinitionInformation['hasReferencesForNewFileExtension'] === false
151  )
152  ) {
153  continue;
154  }
155 
156  if (
157  $formDefinitionInformation['hasNewFileExtension'] === false
158  && $formDefinitionInformation['location'] === 'storage'
159  ) {
160  $updateNeeded = true;
161  $this->output->writeln('Form definition files were found that should be migrated to be named .form.yaml.');
162  }
163 
164  if (
165  $formDefinitionInformation['hasNewFileExtension']
166  && $formDefinitionInformation['hasReferencesForOldFileExtension']
167  ) {
168  $updateNeeded = true;
169  $this->output->writeln('Referenced form definition files found that should be updated.');
170  }
171 
172  if (
173  $formDefinitionInformation['referencesForOldFileExtensionNeedsFlexformUpdates'] === true
174  || $formDefinitionInformation['referencesForNewFileExtensionNeedsFlexformUpdates'] === true
175  ) {
176  $updateNeeded = true;
177  if ($formDefinitionInformation['hasNewFileExtension'] === true) {
178  $this->output->writeln('Referenced form definition files found that should be updated.');
179  } elseif ($formDefinitionInformation['location'] === 'storage') {
180  $this->output->writeln('Referenced form definition files found that should be updated.');
181  } else {
182  $this->output->writeln(
183  '<warning>There are references to form definitions which are located in extensions and thus cannot be renamed automatically by this wizard.'
184  . 'This form definitions from extensions that do not end with .form.yaml have to be renamed by hand!'
185  . 'After that you can run this wizard again to migrate the references.</warning>'
186  );
187  }
188  }
189  }
190 
191  return $updateNeeded;
192  }
193 
199  public function ‪executeUpdate(): bool
200  {
201  $success = true;
202 
203  ‪$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
204  $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
205  $filePersistenceSlot = GeneralUtility::makeInstance(FilePersistenceSlot::class);
206 
207  $this->connection = $connectionPool->getConnectionForTable('tt_content');
208  $this->persistenceManager = $this->‪getObjectManager()->‪get(FormPersistenceManager::class);
209  $this->resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
210  $this->referenceIndex = GeneralUtility::makeInstance(ReferenceIndex::class);
211  $this->flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
212 
213  $filePersistenceSlot->defineInvocation(
215  true
216  );
217 
218  $formDefinitionsInformation = $this->‪getFormDefinitionsInformation();
219  foreach ($formDefinitionsInformation as $currentPersistenceIdentifier => $formDefinitionInformation) {
220  if (
221  (
222  $formDefinitionInformation['hasNewFileExtension'] === true
223  && $formDefinitionInformation['hasReferencesForOldFileExtension'] === false
224  && $formDefinitionInformation['hasReferencesForNewFileExtension'] === false
225  )
226  || (
227  $formDefinitionInformation['hasNewFileExtension'] === false
228  && $formDefinitionInformation['location'] === 'extension'
229  && $formDefinitionInformation['hasReferencesForOldFileExtension'] === false
230  && $formDefinitionInformation['hasReferencesForNewFileExtension'] === false
231  )
232  ) {
233  continue;
234  }
235 
236  if (
237  $formDefinitionInformation['hasNewFileExtension'] === true
238  && (
239  $formDefinitionInformation['hasReferencesForOldFileExtension'] === true
240  || $formDefinitionInformation['hasReferencesForNewFileExtension'] === true
241  )
242  ) {
243  foreach ($formDefinitionInformation['referencesForOldFileExtension'] as $referenceForOldFileExtension) {
244  $newFlexformXml = $this->‪generateNewFlexformForReference(
245  $referenceForOldFileExtension,
246  $referenceForOldFileExtension['sheetIdentifiersWhichNeedsUpdate'],
247  $formDefinitionInformation['persistenceIdentifier']
248  );
250  $referenceForOldFileExtension['ttContentUid'],
251  $newFlexformXml,
252  true
253  );
254  }
255 
256  foreach ($formDefinitionInformation['referencesForNewFileExtension'] as $referenceForNewFileExtension) {
257  $newFlexformXml = $this->‪generateNewFlexformForReference(
258  $referenceForNewFileExtension,
259  $referenceForNewFileExtension['sheetIdentifiersWhichNeedsUpdate']
260  );
262  $referenceForNewFileExtension['ttContentUid'],
263  $newFlexformXml
264  );
265  }
266 
267  continue;
268  }
269 
270  if ($formDefinitionInformation['location'] === 'storage') {
271  $file = $formDefinitionInformation['file'];
272 
273  $newPossiblePersistenceIdentifier = $this->persistenceManager->getUniquePersistenceIdentifier(
274  $file->getNameWithoutExtension(),
275  $file->getParentFolder()->getCombinedIdentifier()
276  );
277  $newFileName = ‪PathUtility::pathinfo(
278  $newPossiblePersistenceIdentifier,
279  PATHINFO_BASENAME
280  );
281 
282  try {
283  $file->rename($newFileName, ‪DuplicationBehavior::RENAME);
284  $newPersistenceIdentifier = $file->getCombinedIdentifier();
285  } catch (\‪Exception $e) {
286  $this->output->writeln(sprintf(
287  '<error>Failed to rename form definition "%s" to "%s".</error>',
288  $formDefinitionInformation['persistenceIdentifier'],
289  $newFileName
290  ));
291  $success = false;
292  continue;
293  }
294 
295  if (
296  $formDefinitionInformation['hasReferencesForOldFileExtension'] === true
297  || $formDefinitionInformation['hasReferencesForNewFileExtension'] === true
298  ) {
299  foreach ($formDefinitionInformation['referencesForOldFileExtension'] as $referenceForOldFileExtension) {
300  $sheetIdentifiersWhichNeedsUpdate = $this->‪getSheetIdentifiersWhichNeedsUpdate(
301  $referenceForOldFileExtension['flexform'],
302  $formDefinitionsInformation,
303  $currentPersistenceIdentifier,
304  $formDefinitionInformation['persistenceIdentifier'],
305  $newPersistenceIdentifier
306  );
307  $newFlexformXml = $this->‪generateNewFlexformForReference(
308  $referenceForOldFileExtension,
309  $sheetIdentifiersWhichNeedsUpdate,
310  $newPersistenceIdentifier
311  );
313  $referenceForOldFileExtension['ttContentUid'],
314  $newFlexformXml
315  );
316  }
317 
318  foreach ($formDefinitionInformation['referencesForNewFileExtension'] as $referenceForNewFileExtension) {
319  $sheetIdentifiersWhichNeedsUpdate = $this->‪getSheetIdentifiersWhichNeedsUpdate(
320  $referenceForNewFileExtension['flexform'],
321  $formDefinitionsInformation,
322  $currentPersistenceIdentifier,
323  $formDefinitionInformation['persistenceIdentifier'],
324  $newPersistenceIdentifier
325  );
326  $newFlexformXml = $this->‪generateNewFlexformForReference(
327  $referenceForNewFileExtension,
328  $sheetIdentifiersWhichNeedsUpdate,
329  $newPersistenceIdentifier
330  );
332  $referenceForNewFileExtension['ttContentUid'],
333  $newFlexformXml
334  );
335  }
336  }
337  } else {
338  $success = false;
339  $this->output->writeln(sprintf(
340  '<error>Failed to rename form definition "%s" to "%s". You have to be rename it by hand!. '
341  . 'After that you can run this wizard again to migrate the references.</error>',
342  $formDefinitionInformation['persistenceIdentifier'],
343  $this->‪getNewPersistenceIdentifier($formDefinitionInformation['persistenceIdentifier'])
344  ));
345  }
346  }
347 
348  $filePersistenceSlot->defineInvocation(
350  null
351  );
352 
353  return $success;
354  }
355 
359  protected function ‪getFormDefinitionsInformation(): array
360  {
361  $formDefinitionsInformation = array_merge(
364  );
365 
366  $formDefinitionsInformation = $this->‪enrichFormDefinitionsInformationWithDataFromReferences($formDefinitionsInformation);
367 
368  return $formDefinitionsInformation;
369  }
370 
374  protected function ‪getFormDefinitionsInformationFromStorages(): array
375  {
376  $formDefinitionsInformation = [];
377 
378  foreach ($this->persistenceManager->retrieveYamlFilesFromStorageFolders() as $file) {
379  $persistenceIdentifier = $file->getCombinedIdentifier();
380 
381  $formDefinition = $this->‪getFormDefinition($file);
382  if (empty($formDefinition)) {
383  continue;
384  }
385 
386  $formDefinitionsInformation[$persistenceIdentifier] = $this->‪setFormDefinitionInformationData(
387  $persistenceIdentifier,
388  $formDefinition,
389  $file,
390  'storage'
391  );
392  }
393 
394  return $formDefinitionsInformation;
395  }
396 
400  protected function ‪getFormDefinitionsInformationFromExtensions(): array
401  {
402  $formDefinitionsInformation = [];
403 
404  foreach ($this->persistenceManager->retrieveYamlFilesFromExtensionFolders() as $persistenceIdentifier => $_) {
405  try {
406  $file = $this->resourceFactory->retrieveFileOrFolderObject($persistenceIdentifier);
407  } catch (\‪Exception $exception) {
408  continue;
409  }
410 
411  $formDefinition = $this->‪getFormDefinition($file);
412  if (empty($formDefinition)) {
413  continue;
414  }
415 
416  $formDefinitionsInformation[$persistenceIdentifier] = $this->‪setFormDefinitionInformationData(
417  $persistenceIdentifier,
418  $formDefinition,
419  $file,
420  'extension'
421  );
422  }
423 
424  return $formDefinitionsInformation;
425  }
426 
434  protected function ‪setFormDefinitionInformationData(
435  string $persistenceIdentifier,
436  array $formDefinition,
437  File $file,
438  string $localtion
439  ): array {
440  return [
441  'location' => $localtion,
442  'persistenceIdentifier' => $persistenceIdentifier,
443  'prototypeName' => $formDefinition['prototypeName'],
444  'formIdentifier' => $formDefinition['identifier'],
445  'file' => $file,
446  'referencesForOldFileExtension' => [],
447  'referencesForNewFileExtension' => [],
448  'hasNewFileExtension' => $this->‪hasNewFileExtension($persistenceIdentifier),
449  'hasReferencesForOldFileExtension' => false,
450  'hasReferencesForNewFileExtension' => false,
451  'referencesForOldFileExtensionNeedsFlexformUpdates' => false,
452  'referencesForNewFileExtensionNeedsFlexformUpdates' => false,
453  ];
454  }
455 
460  protected function ‪enrichFormDefinitionsInformationWithDataFromReferences(array $formDefinitionsInformation): array
461  {
462  foreach ($this->‪getAllFlexformFieldsFromFormPlugins() as $pluginData) {
463  if (empty($pluginData['pi_flexform'])) {
464  continue;
465  }
466  $flexform = GeneralUtility::xml2array($pluginData['pi_flexform']);
467  $referencedPersistenceIdentifier = $this->‪getPersistenceIdentifierFromFlexform($flexform);
468  $referenceHasNewFileExtension = $this->‪hasNewFileExtension($referencedPersistenceIdentifier);
469  $possibleOldReferencedPersistenceIdentifier = $this->‪getOldPersistenceIdentifier($referencedPersistenceIdentifier);
470  $possibleNewReferencedPersistenceIdentifier = $this->‪getNewPersistenceIdentifier($referencedPersistenceIdentifier);
471 
472  $referenceData = [
473  'scope' => null,
474  'ttContentUid' => (int)$pluginData['uid'],
475  'flexform' => $flexform,
476  'sheetIdentifiersWhichNeedsUpdate' => [],
477  ];
478 
479  $targetPersistenceIdentifier = null;
480  if (array_key_exists($referencedPersistenceIdentifier, $formDefinitionsInformation)) {
481  $targetPersistenceIdentifier = $referencedPersistenceIdentifier;
482  if ($referenceHasNewFileExtension) {
483  $referenceData['scope'] = 'referencesForNewFileExtension';
484  } else {
485  $referenceData['scope'] = 'referencesForOldFileExtension';
486  }
487  } else {
488  if ($referenceHasNewFileExtension) {
489  if (array_key_exists($possibleOldReferencedPersistenceIdentifier, $formDefinitionsInformation)) {
490  $targetPersistenceIdentifier = $possibleOldReferencedPersistenceIdentifier;
491  $referenceData['scope'] = 'referencesForNewFileExtension';
492  } else {
493  // There is no existing file for this reference
494  continue;
495  }
496  } else {
497  if (array_key_exists($possibleNewReferencedPersistenceIdentifier, $formDefinitionsInformation)) {
498  $targetPersistenceIdentifier = $possibleNewReferencedPersistenceIdentifier;
499  $referenceData['scope'] = 'referencesForOldFileExtension';
500  } else {
501  // There is no existing file for this reference
502  continue;
503  }
504  }
505  }
506 
507  $referenceData['sheetIdentifiersWhichNeedsUpdate'] = $this->‪getSheetIdentifiersWhichNeedsUpdate(
508  $flexform,
509  $formDefinitionsInformation,
510  $targetPersistenceIdentifier,
511  $possibleOldReferencedPersistenceIdentifier,
512  $possibleNewReferencedPersistenceIdentifier
513  );
514 
515  $scope = $referenceData['scope'];
516 
517  $formDefinitionsInformation[$targetPersistenceIdentifier][$scope][] = $referenceData;
518  if ($scope === 'referencesForOldFileExtension') {
519  $formDefinitionsInformation[$targetPersistenceIdentifier]['hasReferencesForOldFileExtension'] = true;
520  $formDefinitionsInformation[$targetPersistenceIdentifier]['referencesForOldFileExtensionNeedsFlexformUpdates'] = !empty($referenceData['sheetIdentifiersWhichNeedsUpdate']);
521  } else {
522  $formDefinitionsInformation[$targetPersistenceIdentifier]['hasReferencesForNewFileExtension'] = true;
523  $formDefinitionsInformation[$targetPersistenceIdentifier]['referencesForNewFileExtensionNeedsFlexformUpdates'] = !empty($referenceData['sheetIdentifiersWhichNeedsUpdate']);
524  }
525  }
526 
527  return $formDefinitionsInformation;
528  }
529 
538  protected function ‪getSheetIdentifiersWhichNeedsUpdate(
539  array $flexform,
540  array $formDefinitionsInformation,
541  string $targetPersistenceIdentifier,
542  string $possibleOldReferencedPersistenceIdentifier,
543  string $possibleNewReferencedPersistenceIdentifier
544  ): array {
545  $sheetIdentifiersWhichNeedsUpdate = [];
546 
547  $sheetIdentifiers = $this->‪getSheetIdentifiersForFinisherOverrides($flexform);
548  foreach ($sheetIdentifiers as $currentSheetIdentifier => $finisherIdentifier) {
549  $sheetIdentifierForOldPersistenceIdentifier = $this->‪buildExpectedSheetIdentifier(
550  $possibleOldReferencedPersistenceIdentifier,
551  $formDefinitionsInformation[$targetPersistenceIdentifier]['prototypeName'],
552  $formDefinitionsInformation[$targetPersistenceIdentifier]['formIdentifier'],
553  $finisherIdentifier
554  );
555 
556  $sheetIdentifierForNewPersistenceIdentifier = $this->‪buildExpectedSheetIdentifier(
557  $possibleNewReferencedPersistenceIdentifier,
558  $formDefinitionsInformation[$targetPersistenceIdentifier]['prototypeName'],
559  $formDefinitionsInformation[$targetPersistenceIdentifier]['formIdentifier'],
560  $finisherIdentifier
561  );
562 
563  if (
564  $currentSheetIdentifier === $sheetIdentifierForOldPersistenceIdentifier
565  && !array_key_exists($sheetIdentifierForNewPersistenceIdentifier, $sheetIdentifiers)
566  ) {
567  $sheetIdentifiersWhichNeedsUpdate[$currentSheetIdentifier] = $sheetIdentifierForNewPersistenceIdentifier;
568  }
569  }
570 
571  return $sheetIdentifiersWhichNeedsUpdate;
572  }
573 
578  protected function ‪getSheetIdentifiersForFinisherOverrides(array $flexform): array
579  {
580  $sheetIdentifiers = [];
581  foreach ($this->‪getFinisherSheetsFromFlexform($flexform) as $sheetIdentifier => $sheetData) {
582  $itemOptionPath = array_keys($sheetData['lDEF']);
583  $firstSheetItemOptionPath = array_shift($itemOptionPath);
584  preg_match('#^settings\.finishers\.(.*)\..+$#', $firstSheetItemOptionPath, $matches);
585  if (!isset($matches[1])) {
586  continue;
587  }
588  $sheetIdentifiers[$sheetIdentifier] = $matches[1];
589  }
590 
591  return $sheetIdentifiers;
592  }
593 
598  protected function ‪getFinisherSheetsFromFlexform(array $flexform): array
599  {
600  if (!isset($flexform['data'])) {
601  return [];
602  }
603 
604  return array_filter(
605  $flexform['data'],
606  function ($key) {
607  return $key !== 'sDEF' && strlen($key) === 32;
608  },
609  ARRAY_FILTER_USE_KEY
610  );
611  }
612 
617  protected function ‪getPersistenceIdentifierFromFlexform(array $flexform): string
618  {
619  return $flexform['data']['sDEF']['lDEF']['settings.persistenceIdentifier']['vDEF'] ?? '';
620  }
621 
628  protected function ‪generateNewFlexformForReference(
629  array $referenceData,
630  array $sheetIdentifiersWhichNeedsUpdate,
631  string $newPersistenceIdentifier = ''
632  ): string {
633  $flexform = $referenceData['flexform'];
634  if (!empty($newPersistenceIdentifier)) {
635  $flexform['data']['sDEF']['lDEF']['settings.persistenceIdentifier']['vDEF'] = $newPersistenceIdentifier;
636  }
637 
638  foreach ($sheetIdentifiersWhichNeedsUpdate as $oldSheetIdentifier => $newSheetIdentifier) {
639  $flexform['data'][$newSheetIdentifier] = $flexform['data'][$oldSheetIdentifier];
640  unset($flexform['data'][$oldSheetIdentifier]);
641  }
642 
643  return $this->flexFormTools->flexArray2Xml($flexform, true);
644  }
645 
650  protected function ‪hasNewFileExtension(string $persistenceIdentifier): bool
651  {
653  $persistenceIdentifier,
655  );
656  }
657 
662  protected function ‪looksLikeAFormDefinition(array $formDefinition): bool
663  {
664  return isset($formDefinition['identifier'], $formDefinition['type']) && $formDefinition['type'] === 'Form';
665  }
666 
671  protected function ‪getOldPersistenceIdentifier(string $persistenceIdentifier): string
672  {
673  return preg_replace(
674  '
675  #^(.*)(\.form\.yaml)$#',
676  '${1}.yaml',
677  $persistenceIdentifier
678  );
679  }
680 
685  protected function ‪getNewPersistenceIdentifier(string $persistenceIdentifier): string
686  {
687  return preg_replace(
688  '#(?<!\.form).yaml$#',
689  '.form.yaml',
690  $persistenceIdentifier
691  );
692  }
693 
701  protected function ‪buildExpectedSheetIdentifier(
702  string $persistenceIdentifier,
703  string $prototypeName,
704  string $formIdentifier,
705  string $finisherIdentifier
706  ): string {
707  return md5(
708  implode('', [
709  $persistenceIdentifier,
710  $prototypeName,
711  $formIdentifier,
712  $finisherIdentifier
713  ])
714  );
715  }
716 
721  protected function ‪getFormDefinition(‪File $file): array
722  {
723  try {
724  $rawYamlContent = $file->‪getContents();
725  $formDefinition = $this->‪extractMetaDataFromCouldBeFormDefinition($rawYamlContent);
726 
727  if (!$this->‪looksLikeAFormDefinition($formDefinition)) {
728  $formDefinition = [];
729  }
730  } catch (\‪Exception $exception) {
731  $formDefinition = [];
732  }
733 
734  return $formDefinition;
735  }
736 
741  protected function ‪extractMetaDataFromCouldBeFormDefinition(string $maybeRawFormDefinition): array
742  {
743  $metaDataProperties = ['identifier', 'type', 'label', 'prototypeName'];
744  $metaData = [];
745  foreach (explode("\n", $maybeRawFormDefinition) as $line) {
746  if (empty($line) || $line[0] === ' ') {
747  continue;
748  }
749 
750  [$key, $value] = explode(':', $line);
751  if (
752  empty($key)
753  || empty($value)
754  || !in_array($key, $metaDataProperties)
755  ) {
756  continue;
757  }
758 
759  $value = trim($value, ' \'"');
760  $metaData[$key] = $value;
761  }
762 
763  return $metaData;
764  }
765 
769  protected function ‪getAllFlexformFieldsFromFormPlugins(): array
770  {
771  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
772  ->getQueryBuilderForTable('tt_content');
773  $queryBuilder->getRestrictions()
774  ->removeAll()
775  ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
776 
777  $records = $queryBuilder
778  ->select('uid', 'pi_flexform')
779  ->from('tt_content')
780  ->where(
781  $queryBuilder->expr()->eq(
782  'CType',
783  $queryBuilder->createNamedParameter('form_formframework', \PDO::PARAM_STR)
784  )
785  )
786  ->execute()
787  ->fetchAll();
788 
789  return $records;
790  }
791 
797  protected function ‪updateContentReference(
798  int $uid,
799  string $flexform,
800  bool $updateRefindex = false
801  ): void {
802  $this->connection->update(
803  'tt_content',
804  ['pi_flexform' => $flexform],
805  ['uid' => $uid]
806  );
807 
808  if (!$updateRefindex) {
809  return;
810  }
811 
812  $this->referenceIndex->updateRefIndexTable(
813  'tt_content',
814  $uid
815  );
816  }
817 
821  protected function ‪getObjectManager(): ‪ObjectManager
822  {
823  return GeneralUtility::makeInstance(ObjectManager::class);
824  }
825 }
‪TYPO3\CMS\Core\Utility\PathUtility
Definition: PathUtility.php:23
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFormDefinition
‪array getFormDefinition(File $file)
Definition: FormFileExtensionUpdate.php:715
‪TYPO3\CMS\Core\Resource\DuplicationBehavior
Definition: DuplicationBehavior.php:23
‪TYPO3\CMS\Core\Utility\StringUtility\endsWith
‪static bool endsWith($haystack, $needle)
Definition: StringUtility.php:60
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFormDefinitionsInformationFromExtensions
‪array getFormDefinitionsInformationFromExtensions()
Definition: FormFileExtensionUpdate.php:394
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$referenceIndex
‪ReferenceIndex $referenceIndex
Definition: FormFileExtensionUpdate.php:59
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$output
‪OutputInterface $output
Definition: FormFileExtensionUpdate.php:47
‪TYPO3\CMS\Core\Database\ReferenceIndex
Definition: ReferenceIndex.php:50
‪TYPO3\CMS\Install\Updates\ChattyInterface
Definition: ChattyInterface.php:25
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getDescription
‪string getDescription()
Definition: FormFileExtensionUpdate.php:95
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\hasNewFileExtension
‪bool hasNewFileExtension(string $persistenceIdentifier)
Definition: FormFileExtensionUpdate.php:644
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getSheetIdentifiersForFinisherOverrides
‪array getSheetIdentifiersForFinisherOverrides(array $flexform)
Definition: FormFileExtensionUpdate.php:572
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$persistenceManager
‪FormPersistenceManager $persistenceManager
Definition: FormFileExtensionUpdate.php:51
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getOldPersistenceIdentifier
‪string getOldPersistenceIdentifier(string $persistenceIdentifier)
Definition: FormFileExtensionUpdate.php:665
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFinisherSheetsFromFlexform
‪array getFinisherSheetsFromFlexform(array $flexform)
Definition: FormFileExtensionUpdate.php:592
‪TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite
Definition: DatabaseUpdatedPrerequisite.php:28
‪TYPO3\CMS\Core\Utility\PathUtility\pathinfo
‪static string array pathinfo($path, $options=null)
Definition: PathUtility.php:207
‪TYPO3\CMS\Form\Exception
Definition: Exception.php:24
‪TYPO3\CMS\Form\Hooks
Definition: DataStructureIdentifierHook.php:3
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$flexFormTools
‪FlexFormTools $flexFormTools
Definition: FormFileExtensionUpdate.php:63
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\updateNecessary
‪bool updateNecessary()
Definition: FormFileExtensionUpdate.php:126
‪TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager
Definition: FormPersistenceManager.php:48
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\enrichFormDefinitionsInformationWithDataFromReferences
‪array enrichFormDefinitionsInformationWithDataFromReferences(array $formDefinitionsInformation)
Definition: FormFileExtensionUpdate.php:454
‪TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools
Definition: FlexFormTools.php:36
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$resourceFactory
‪ResourceFactory $resourceFactory
Definition: FormFileExtensionUpdate.php:55
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:33
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\extractMetaDataFromCouldBeFormDefinition
‪array extractMetaDataFromCouldBeFormDefinition(string $maybeRawFormDefinition)
Definition: FormFileExtensionUpdate.php:735
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\generateNewFlexformForReference
‪string generateNewFlexformForReference(array $referenceData, array $sheetIdentifiersWhichNeedsUpdate, string $newPersistenceIdentifier='')
Definition: FormFileExtensionUpdate.php:622
‪TYPO3\CMS\Core\Resource\File
Definition: File.php:23
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getNewPersistenceIdentifier
‪string getNewPersistenceIdentifier(string $persistenceIdentifier)
Definition: FormFileExtensionUpdate.php:679
‪TYPO3\CMS\Core\Resource\DuplicationBehavior\RENAME
‪const RENAME
Definition: DuplicationBehavior.php:31
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\setOutput
‪setOutput(OutputInterface $output)
Definition: FormFileExtensionUpdate.php:116
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\executeUpdate
‪bool executeUpdate()
Definition: FormFileExtensionUpdate.php:193
‪TYPO3\CMS\Core\Error\Exception
Definition: Exception.php:21
‪TYPO3\CMS\Form\Slot\FilePersistenceSlot
Definition: FilePersistenceSlot.php:29
‪TYPO3\CMS\Core\Resource\File\getContents
‪string getContents()
Definition: File.php:130
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\updateContentReference
‪updateContentReference(int $uid, string $flexform, bool $updateRefindex=false)
Definition: FormFileExtensionUpdate.php:791
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getObjectManager
‪ObjectManager getObjectManager()
Definition: FormFileExtensionUpdate.php:815
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getPersistenceIdentifierFromFlexform
‪string getPersistenceIdentifierFromFlexform(array $flexform)
Definition: FormFileExtensionUpdate.php:611
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:31
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getSheetIdentifiersWhichNeedsUpdate
‪array getSheetIdentifiersWhichNeedsUpdate(array $flexform, array $formDefinitionsInformation, string $targetPersistenceIdentifier, string $possibleOldReferencedPersistenceIdentifier, string $possibleNewReferencedPersistenceIdentifier)
Definition: FormFileExtensionUpdate.php:532
‪TYPO3\CMS\Install\Updates\UpgradeWizardInterface
Definition: UpgradeWizardInterface.php:22
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\setFormDefinitionInformationData
‪array setFormDefinitionInformationData(string $persistenceIdentifier, array $formDefinition, File $file, string $localtion)
Definition: FormFileExtensionUpdate.php:428
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getAllFlexformFieldsFromFormPlugins
‪array getAllFlexformFieldsFromFormPlugins()
Definition: FormFileExtensionUpdate.php:763
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:26
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\buildExpectedSheetIdentifier
‪string buildExpectedSheetIdentifier(string $persistenceIdentifier, string $prototypeName, string $formIdentifier, string $finisherIdentifier)
Definition: FormFileExtensionUpdate.php:695
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getPrerequisites
‪string[] getPrerequisites()
Definition: FormFileExtensionUpdate.php:108
‪TYPO3\CMS\Extbase\Object\ObjectManager\get
‪object &T get($objectName,... $constructorArguments)
Definition: ObjectManager.php:94
‪TYPO3\CMS\Form\Slot\FilePersistenceSlot\COMMAND_FILE_RENAME
‪const COMMAND_FILE_RENAME
Definition: FilePersistenceSlot.php:33
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\$connection
‪Connection $connection
Definition: FormFileExtensionUpdate.php:67
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFormDefinitionsInformation
‪array getFormDefinitionsInformation()
Definition: FormFileExtensionUpdate.php:353
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:44
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate
Definition: FormFileExtensionUpdate.php:44
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getFormDefinitionsInformationFromStorages
‪array getFormDefinitionsInformationFromStorages()
Definition: FormFileExtensionUpdate.php:368
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getIdentifier
‪string getIdentifier()
Definition: FormFileExtensionUpdate.php:75
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:21
‪TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite
Definition: ReferenceIndexUpdatedPrerequisite.php:31
‪TYPO3\CMS\Extbase\Object\ObjectManager
Definition: ObjectManager.php:25
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\getTitle
‪string getTitle()
Definition: FormFileExtensionUpdate.php:85
‪TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager\FORM_DEFINITION_FILE_EXTENSION
‪const FORM_DEFINITION_FILE_EXTENSION
Definition: FormPersistenceManager.php:49
‪TYPO3\CMS\Form\Hooks\FormFileExtensionUpdate\looksLikeAFormDefinition
‪bool looksLikeAFormDefinition(array $formDefinition)
Definition: FormFileExtensionUpdate.php:656