From 70ddd782641ccbdbc37138bb5600be0cb5bbf5d1 Mon Sep 17 00:00:00 2001
From: Markus Klein <markus.klein@typo3.org>
Date: Wed, 10 May 2017 13:28:03 +0200
Subject: [PATCH] [BUGFIX] Ensure Frontend User image update is not offered

Releases: master, 8.7
Resolves: #81180
Change-Id: I87a8a5b694ad579f6ba31feb10094298ecabf9e7
Reviewed-on: https://review.typo3.org/52745
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Johannes Kasberger <johannes.kasberger@reelworx.at>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Classes/Updates/FrontendUserImageUpdateWizard.php     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/install/Classes/Updates/FrontendUserImageUpdateWizard.php b/typo3/sysext/install/Classes/Updates/FrontendUserImageUpdateWizard.php
index bc51c1ec2457..3989311a1ec8 100644
--- a/typo3/sysext/install/Classes/Updates/FrontendUserImageUpdateWizard.php
+++ b/typo3/sysext/install/Classes/Updates/FrontendUserImageUpdateWizard.php
@@ -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) {
-- 
GitLab