[BUGFIX] Exception thrown in update wizard if file does not exists 04/25004/4
authorFrans Saris <franssaris@gmail.com>
Fri, 25 Oct 2013 12:05:41 +0000 (14:05 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 19 Nov 2013 21:41:38 +0000 (22:41 +0100)
When fetching a file that does not exists a exception is
thrown in the update wizard to update RTE file links to FAL.
The exception will now be catched.

Resolves: #53127
Releases: 6.2
Change-Id: I81a204506abfe2f462142ccc504f3a4e2cef138f
Reviewed-on: https://review.typo3.org/25004
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/install/Classes/Updates/RteFileLinksUpdateWizard.php

index 1292ff6..591e25c 100644 (file)
@@ -204,7 +204,12 @@ class RteFileLinksUpdateWizard extends AbstractUpdate {
         */
        protected function convertFileLinks(array $reference, array $record) {
                // First of all, try to get the referenced file. Continue only if found.
-               $fileObject = $this->fetchReferencedFile($reference['ref_string'], $reference);
+               try {
+                       $fileObject = $this->fetchReferencedFile($reference['ref_string'], $reference);
+               } catch (\InvalidArgumentException $exception) {
+                       $fileObject = NULL;
+                       $this->errors[] = $reference['ref_string'] . ' could not be replaced. File does not exist.';
+               }
                if ($fileObject instanceof \TYPO3\CMS\Core\Resource\AbstractFile) {
                        // Next, match the reference path in the content to be sure it's present inside a <link> tag
                        $content = $record[$reference['field']];