Hi ppl!
As you know, Opencart 4 has a built-in upgrade function. But the fact is - it is not working at all.
Oh, if that person that wrote that code (whomever it is) had tested it a single time - but he didn't.
I can't imagine how this can happen at all!
Anyway, here is the fix from me. Actually, it took 12 fixes that any normal programmer will not be able to carry just to upgrade the single store.
But the fact is with this fix the Opencart 4 upgrade should execute ok just by a few clicks in admin.
Please give me feedback, especially if it doesn't work for you.
Link to the fix - https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=45216
As you know, Opencart 4 has a built-in upgrade function. But the fact is - it is not working at all.
Oh, if that person that wrote that code (whomever it is) had tested it a single time - but he didn't.
I can't imagine how this can happen at all!
Anyway, here is the fix from me. Actually, it took 12 fixes that any normal programmer will not be able to carry just to upgrade the single store.
But the fact is with this fix the Opencart 4 upgrade should execute ok just by a few clicks in admin.
Please give me feedback, especially if it doesn't work for you.
Link to the fix - https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=45216
Code: Select all
// Rise files per batch limit
$php = str_replace("\$limit = 200;",
"\$limit = 1000;", $php);
Code: Select all
// Fix file copy error display
$php = str_replace("\$this->language->get('error_copy')",
"'Failed to copy file %s to %s'", $php);
Code: Select all
$json['text'] = 'Upgrading DB, this may take some time...';
Code: Select all
$('#status').html(
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Sure, each code is added for a reason )
Code: Select all
// Rise files per batch limit
$php = str_replace("\$limit = 200;",
"\$limit = 1000;", $php);
Code: Select all
// Fix file copy error display
$php = str_replace("\$this->language->get('error_copy')",
"'Failed to copy file %s to %s'", $php);
Code: Select all
$json['text'] = 'Upgrading DB, this may take some time...';
Code: Select all
$('#status').html(
This is the fix for that, if any sort of error happens - it will be displayed as big red text.
If you are wondering why there are 2 hardcoded text strings - I'm pretty sure that nobody will do translations specially for my fix.
I am not wondering. It rather remains to be seen if it is meant to be fixed.MaxD wrote: ↑Thu Jul 06, 2023 8:09 amSure, each code is added for a reason )
Current update implementation has super-slow zip extraction way - it actually opens zip for each file, extracts single file, and closes it. Fixing this increased unzip speed 10x at least. After that the limit to extract 200 files per request is very low, so it is raised. Even with limit 1000 single request takes like 2 seconds.Code: Select all
// Rise files per batch limit $php = str_replace("\$limit = 200;", "\$limit = 1000;", $php);
The "error_copy" string is simply missing in install/language/en-gb/upgrade/upgrade.php, and guess what? If upgrade step 2 (most files extraction) fails to write some file - it just says error_copy instead of any details )))Code: Select all
// Fix file copy error display $php = str_replace("\$this->language->get('error_copy')", "'Failed to copy file %s to %s'", $php);
Upgrading DB takes most time in upgrade process now, and it is not indicated in any special way. People can think that the process got hung, so I added additional indication what's going on and that this will take some time.Code: Select all
$json['text'] = 'Upgrading DB, this may take some time...';
If some error happen (that gives error output instead of pretty JSON), the upgrade tool makes the worst thing it could do - nothing! Literally nothing, it keeps showing current step text (like 'Extracting files ...') forever. Poor user will wait some 10 minutes thinking the process is going - but it was finished with error long ago ))Code: Select all
$('#status').html(
This is the fix for that, if any sort of error happens - it will be displayed as big red text.
If you are wondering why there are 2 hardcoded text strings - I'm pretty sure that nobody will do translations specially for my fix.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Here's the answer: https://github.com/opencart/opencart/is ... 1623693891 .
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thank you, answered Daniel there.straightlight wrote: ↑Thu Jul 06, 2023 9:39 pmHere's the answer: https://github.com/opencart/opencart/is ... 1623693891 .
Who is online
Users browsing this forum: No registered users and 2 guests