Bug #57393
closedTask #57578: TceformsUpdateWizard improvements (Migrate all file relations from tt_content.image and pages.media)
Endless Loop in TceformsUpdateWizard
100%
Description
I'm currently updating a large TYPO3 Website from 4.5 to 6.2 and have found a bug in the Upgrade Wizard.
The migration with title 'Migrate all file relations from tt_content.image and pages.media' (typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php) ends up in an endless loop.
The problem exists in the do/while loop starting at line 188 respectively in the getRecordsFromTable method in typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php.
188 do { 189 $records = $this->getRecordsFromTable($table, $fieldToMigrate, $fieldsToGet, self::RECORDS_PER_QUERY); 190 foreach ($records as $record) { 191 $this->migrateField($table, $record, $fieldToMigrate, $fieldConfiguration, $customMessages); 192 } 193 } while (count($records) === self::RECORDS_PER_QUERY);
self::RECORDS_PER_QUERY is set to 1000. Every time a query like 'select ... LIMIT 1000' is created. Because there's no starting point defined after the LIMIT statement (which should be 0 on first loop and then += self::RECORDS_PER_QUERY) the query will always fetch the first self::RECORDS_PER_QUERY entries. Thus the while condition is always true.
To fix this the LIMIT statement should have the starting point included like LIMIT <entries_fetched_so_far>, self::RECORDS_PER_QUERY.
Please fix this asap since many people will update their TYPO3 LTS Websites shortly.
Updated by Steffen Krüchten over 10 years ago
I can confirm this Bug, also trying to update a small Installation to 6.2.0 from 4.5.32 with PHP 5.3.27. Everything else went smooth, Frontend is up and running but no Content images at all.
Upgrade Wizard throws a "Uncaught TYPO3 Exception" in Debug-Mode when trying to execute "Migrate all file relations from tt_content.image and pages.media":
PHP Warning: Invalid argument supplied for foreach() in typo3/sysext/install/Classes/Updates/TceformsUpdateWizard.php line 190.
Updated by Markus Klein over 10 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
next-patchlevel)
These are two different issues.
The issue reported here is IMO not an issue. The limit is ok, you can always start from 0, because the select query only looks at records not yet migrated!
Regarding the foreach() thing. There seems to be a DB issue, the select seems to fail.
I'll create a new ticket for this, which introduces a better check and issues an exception with the SQL error.
Updated by Markus Klein over 10 years ago
The new ticket for the foreach() issue is #57572
Updated by Tobias Braumann over 10 years ago
I can confirm this Bug, too. In our case the Problem was that we have a lot of pictures in tt_content,
which no longer exist and the script don't set the image field to 1 or delete the entries.
So in the foreach() there are still the same 1000 entries (infinityloop).
We fix that problem by increasing the value self::RECORDS_PER_QUERY to the number of entries from tt_content.
Updated by Alexander Opitz over 10 years ago
- Status changed from Needs Feedback to New
Updated by Sebastian Helzle about 10 years ago
We also had this issue today with a big site (~15000 pages) and more than 1000 missing media files in the page properties because we tried the upgrade on a lightweight copy without the assets.
Updated by Gerrit Code Review almost 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032
Updated by Gerrit Code Review almost 10 years ago
Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032
Updated by Gerrit Code Review almost 10 years ago
Patch set 3 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032
Updated by Markus Klein almost 10 years ago
We kindly ask you to please test the patch linked above with your databases.
If it works for you, please vote accordingly.
Thanks a lot!
Updated by Markus Klein almost 10 years ago
- Target version set to next-patchlevel
- Complexity changed from easy to medium
Updated by Gerrit Code Review almost 10 years ago
Patch set 4 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032
Updated by Gerrit Code Review almost 10 years ago
Patch set 5 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37032
Updated by shanmugarajan k almost 10 years ago
It seems,once click Execute, i never see this "Migrate all file relations from tt_content.image and pages.media" upgrade wizard.
I have around 10000+ records.
I re-imported the db, but still i could not see the wizard again. can you please let me know if i doing something wrong?
Updated by shanmugarajan k almost 10 years ago
i just saw in the LocalConfiguration.php
'INSTALL' => array() having the 'wizardDone' wizard is entered. Hence its not visible again.
so it seems, this is added as soon as first run completed.
Updated by Markus Klein almost 10 years ago
@shanmugarajan
Which TYPO3 version are you upgrading from?
Are you sure you actually need this patch?
It can well be that the wizard manages to complete the migration in one go, so it won't show up again.
Updated by shanmugarajan k almost 10 years ago
Hello Markus,
Yes. i upgrading from 4.5 to 6.2.
Yes. needed. thanks.
Updated by Nicole Cordes almost 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 57f749d1fec1fa4964f37627ec9868cfdfbd4382.