[BUGFIX] Ensure Frontend User image update is not offered 48/52748/2
authorMarkus Klein <markus.klein@typo3.org>
Wed, 10 May 2017 11:28:03 +0000 (13:28 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 10 May 2017 15:31:14 +0000 (17:31 +0200)
Releases: master, 8.7
Resolves: #81180
Change-Id: I87a8a5b694ad579f6ba31feb10094298ecabf9e7
Reviewed-on: https://review.typo3.org/52748
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/install/Classes/Updates/FrontendUserImageUpdateWizard.php

index bc51c1e..3989311 100644 (file)
@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
 use TYPO3\CMS\Core\Log\Logger;
 use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Registry;
+use TYPO3\CMS\Core\Resource\File;
 use TYPO3\CMS\Core\Resource\ResourceStorage;
 use TYPO3\CMS\Core\Resource\StorageRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -123,13 +124,17 @@ class FrontendUserImageUpdateWizard extends AbstractUpdate
      */
     public function checkForUpdate(&$description)
     {
+        if ($this->isWizardDone()) {
+            return false;
+        }
+
         $description = 'This update wizard goes through all files that are referenced in the fe_users.image field'
             . ' and adds the files to the FAL File Index.<br />'
             . 'It also moves the files from uploads/ to the fileadmin/_migrated/ path.';
 
         $this->init();
 
-        return !$this->isWizardDone() || $this->recordOffset !== [];
+        return $this->recordOffset !== [];
     }
 
     /**
@@ -285,6 +290,7 @@ class FrontendUserImageUpdateWizard extends AbstractUpdate
                 try {
                     // if the source file does not exist, we should just continue, but leave a message in the docs;
                     // ideally, the user would be informed after the update as well.
+                    /** @var File $file */
                     $file = $this->storage->getFile($this->targetPath . $item);
                     $fileUid = $file->getUid();
                 } catch (\InvalidArgumentException $e) {