Commit 8f93108e authored by Morton Jonuschat's avatar Morton Jonuschat Committed by Wouter Wolters
Browse files

[BUGFIX] Log source and target name when renaming files/directories

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's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent 4e31e612
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment