[BUGFIX] Log source and target name when renaming files/directories 59/42959/2
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Tue, 1 Sep 2015 16:25:53 +0000 (18:25 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 1 Sep 2015 19:04:33 +0000 (21:04 +0200)
Retrieve the name of the source before performing the actual rename
to enable logging the proper source name.

Resolves: #69231
Releases: master
Change-Id: I66769da707538ca888ace3fc80250cd52dc9c7b0
Reviewed-on: http://review.typo3.org/42959
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php

index 07ecc6a..cf36884 100644 (file)
@@ -755,13 +755,14 @@ class ExtendedFileUtility extends BasicFileUtility {
                        return FALSE;
                }
                $sourceFileObject = $this->getFileObject($cmds['data']);
+               $sourceFile = $sourceFileObject->getName();
                $targetFile = $cmds['target'];
                $resultObject = NULL;
                if ($sourceFileObject instanceof File) {
                        try {
                                // Try to rename the File
                                $resultObject = $sourceFileObject->rename($targetFile);
-                               $this->writelog(5, 0, 1, 'File renamed from "%s" to "%s"', array($sourceFileObject->getName(), $targetFile));
+                               $this->writelog(5, 0, 1, 'File renamed from "%s" to "%s"', array($sourceFile, $targetFile));
                        } catch (\TYPO3\CMS\Core\Resource\Exception\InsufficientUserPermissionsException $e) {
                                $this->writelog(5, 1, 102, 'You are not allowed to rename files!', '');
                        } catch (\TYPO3\CMS\Core\Resource\Exception\IllegalFileExtensionException $e) {
@@ -778,7 +779,7 @@ class ExtendedFileUtility extends BasicFileUtility {
                        try {
                                // Try to rename the Folder
                                $resultObject = $sourceFileObject->rename($targetFile);
-                               $this->writelog(5, 0, 2, 'Directory renamed from "%s" to "%s"', array($sourceFileObject->getName(), $targetFile));
+                               $this->writelog(5, 0, 2, 'Directory renamed from "%s" to "%s"', array($sourceFile, $targetFile));
                        } catch (\TYPO3\CMS\Core\Resource\Exception\InsufficientUserPermissionsException $e) {
                                $this->writelog(5, 1, 111, 'You are not allowed to rename directories!', '');
                        } catch (\TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException $e) {