Fabrik can only be upgraded from F3 to F4 through the package
Installation. Do not attempt to update directly from git.
Fabrik 4.0 requirements.
If you are upgrading please mention it in any issue (add the corresponding label) and test if it's also an issue in a vanilla J!4/F4
Installation.
Things that users should check before they do their upgrade.
Review the list of
Backward Compatibility Issues . As long as you are J3.10+ you must make these adjustments prior to upgrading to J4.
All hard coded php code (default eval, calc
Elements, allow date functions, eval
Options, eval populate etc) needs to have proper namespace use statements such as
use Joomla\CMS\Factory; or calling it directly in you code such as
$user = \Joomla\CMS\Factory::getUser();
There is no guarantee any of the J prefixed classnames will work. Placing use statements in eval'ed code has been tested on php 8.1.
In order to help you identify all of your
Forms/
Lists/
Elements etc that have php code attached to them you may find
this file to be useful. It will print a nice report for you. I find the small component called jumi very useful for these types of things. The original developer of Jumi is long gone but
here is a version that runs on J3 & J4.
Also, if you are using Factory::getDbo() in your custom php code we suggest you change that now to the following. It will eliminate a bunch of deprecated notices when you start testing your code on J4.
$db = version_compare(\Joomla\CMS\Version::MAJOR_VERSION, "4", ">=") ? Factory::getContainer()->get('DatabaseDriver') : Factory::getDbo();
If you are already on J!4 you don't need the version check, just
use Joomla\CMS\Factory; $db = Factory::getContainer()->get('DatabaseDriver');
or
$db = Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
The
Bootstrap classes have changed for BS5, however, we have added code to transpose your existing classes, either input-xx, spanx or col-md, to the new classes on the fly so you do not need to change them prior to upgrading. Also, whenever you edit an element that has a
Bootstrap class associated with it, it will be updated on save to the new class.
Steps to upgrade
- Use a copy of your live site for testing. Make sure to open and re-save your Fabrik connection in your test site copy.
- In J!3 go to extensions -> manage -> search for fabrik -> (make sure you selected 'All' in the limit box on the right) and disable all.
- Before you can upgrade J!3 to J!4 you must be at the most current version of J!3, so upgrade J!3 if you need to.
- The folder structure of libraries/fabrik will change, i.e. Fabrik 4 will delete and rebuild the tree. If you have any custom files in this tree make sure to have a copy so you can add them again after the update. You must do this also for libraries/fabrik/fabrik/Helpers/Custom.php (if you created this 'Fabrik' file)
- Upgrade to J!4: Change to joomla next. The compatibility check will find fabrik issues (mostly plugins), upgrade anyway.
- Live update: J!3 will be upgraded to J!4. After upgrade J!4 reports database warnings and errors. These will be repaired when fabrik4 is installed.
- Install Fabrik4 from the install package. Do not attempt to upgrade Fabrik via the J! updater. This will take some time.
- Check your folder administrator\components\com_fabrik\sql\updates\mysql
It should contain only files 4xxx.sql, no old files 2xxx.sql and/or 3xxx.sql. If so, delete these old ones (this should happen during Installation but it seems in some cases this is not working).
- In J!4 go to system-> manage -> extensions and only enable fabrik version 4.x plugins you need to use for your application. Leave all fabrik version 3.10 (or lower) extensions and plugins disabled, because they may not work, are not supported and may cause warnings or errors.
Debugging
Enable Joomla's "System Debug" to get the error stack on php errors. Check in your browser dev tools for JS errors.
Set Joomla's "Error Reporting" to get errors, warning, notices. Keep in mind that those informations are helpful for
Debugging but they will break JSON responses. So you may get sticky spinners in popup
Forms, ajax updates/calculations etc. In these cases you will find the informations in your browser's network response.
Please make sure that your custom code is correct, i.e. running on Fabrik3 (with latest Fabrik3 GitHub update) under PHP8.1+, then adapted for J!4, Fabrik4, before creating issues.
And please mention in your issues any setups which are not the default ones ("How to reproduce").
After upgrading
If you used a template before that was based on Protostar and BS2.3.2, this may no longer work as expected on J!4.x. You need to use Casiopeia or any other compatible template for J!4.x.
If you created custom views in components/views/list, components/views/form or components/views/details, these may no longer work on Fabrik4.x. You need to update you custom views according to the default
Bootstrap.
If you have overrides (e.g. in JROOT/templates/your-template/html/layouts/com_fabrik/ or JROOT/templates/your-template/html/com_fabrik/, maybe if you added Fabrik-Joomla-alt-layouts for Bootstrap3 templates) you must remove/update/adapt these files, too.
If you have Google keys (Googlemap, Captcha) check if they are supporting the recent versions (e.g. old ReCaptcha keys won't do if you select reCaptcha invisible).
Code examples
$db = Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
$user = \Joomla\CMS\Factory::getApplication()->getIdentity();
$message = Joomla\CMS\Language\Text::_('some text or language string');
$app = Joomla\CMS\Factory::getApplication();
$app->enqueueMessage($message,'notice');
$app->redirect(Joomla\CMS\Router\Route::_($myurl));
$app->getInput()->get('myparam',...);