Review main Merged

88474[TASK] Use GeneralUtility::writeFile consistently

Benni Mack CR +2 V +2 Normal +33 −37 updated 03/04/25, 14:58

Commit message

This change uses the third argument of
GeneralUtility::writeFile()
consistently, ensuring to call
GeneralUtility::fixPermissions() automatically,
making TYPO3 Core API more consistent.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Mathias Brodala +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Mathias Brodala +1
    • core-ci +1 CI

Issues 1

Files 21

Review log 1011

  1. Benni Mack uploaded patch set 1 03/04/25, 09:28

  2. core-ci voted on patch set 1 V +1 03/04/25, 09:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75084

  3. Mathias Brodala commented on patch set 1 03/04/25, 10:11

    How about making this the default and deprecate the parameter? Of course, the usual deprecation/migration paths are possible.
  4. Benni Mack commented on patch set 1 03/04/25, 10:27

    Reply

    Yes. I want to make this change as a followup for v14-only.
  5. Mathias Brodala commented on patch set 1 03/04/25, 10:44

    Is there a reason not all file_put_contents() calls have been replaced with this? > ± rgrep file_put_contents typo3/sysext/ | grep -v Test.php > typo3/sysext/install/Classes/FolderStructure/FileNode.php: $result = @file_put_contents($absolutePath, $this->targetContent); > typo3/sysext/install/Classes/Service/CoreUpdateService.php: $fileStoreResult = file_put_contents($fileLocation, $fileContent); > typo3/sysext/install/Classes/Service/WebServerConfigurationFileService.php: return $count > 0 && file_put_contents($configurationFilename, $configurationFileContent); > typo3/sysext/install/Classes/Service/WebServerConfigurationFileService.php: return $count > 0 && file_put_contents($configurationFilename, $configurationFileContent); > typo3/sysext/extbase/Tests/Functional/Validation/Validator/AbstractUploadedFileTestCase.php: file_put_contents($testFilename, $content); > typo3/sysext/form/Classes/Mvc/Configuration/YamlSource.php: $byteCount = @file_put_contents($fileToSave, $header . LF . $yaml); > typo3/sysext/core/Classes/Cache/Backend/FileBackend.php: file_put_contents($this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension, $this->get($entryIdentifier)); > typo3/sysext/core/Classes/Cache/Backend/FileBackend.php: file_put_contents($this->cacheDirectory . 'FrozenCache.data', serialize($this->cacheEntryIdentifiers)); > typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php: $result = file_put_contents($filePath, $contents); > typo3/sysext/core/Classes/Resource/Security/SvgSanitizer.php: file_put_contents($targetPath, $sanitizedSvg); > typo3/sysext/core/Classes/Package/Cache/ComposerPackageArtifact.php: file_put_contents($this->packageArtifactsFile, '<?php' . PHP_EOL . 'return ' . PHP_EOL . $cacheEntry->withIdentifier($this->cacheIdentifier)->serialize() . ';');
  6. Benni Mack commented on patch set 1 03/04/25, 12:04

    Reply

    yes. one at time... the other changes might have impact and might be taken separately (there is a patch from Georg that touches a similar area).
  7. Mathias Brodala commented on patch set 1 CR +1 V +1 03/04/25, 13:58

    Thanks for the clarification!
  8. Mathias Brodala commented on patch set 1 03/04/25, 13:58

    Reply

    Done
  9. Georg Ringer voted on patch set 1 CR +1 V +1 03/04/25, 14:56

  10. Georg Ringer voted on patch set 1 CR +2 V +2 03/04/25, 14:58

  11. Georg Ringer merged patch set 2 03/04/25, 14:58