1. "Fabrik 4" helpers needed!

    You are invited to join other community members active in coding, maintaining and improving Fabrik. Please visit https://fabrik.help for more information!
    Dismiss Notice

Migrating from J 2.x / Fabrik 3.0

redirected from Upgrading from Fabrik 3.0 to 3.1 (redirect)

May 19, 2016
Migrating from J 2.x / Fabrik 3.0

  • Upgrade instructions(top)

    As always backup your site files and database before starting!

    There are no structure database changes between Fabrik 3.0 and 3.4+.
    "Fabrik3.4+" is referring to the latest Fabrik version, 3.4.3 at time of writing (May 2016)

    Fabrik3.4+ can't be installed on Joomla2.5.x, so
    • disable the Fabrik System Plugin (in Extensions/Plugins)
    • update Joomla to 3.5.1 (May 2016)
    • not necessary but recommended: rename the existing Fabrik list and form template folders (components/com_fabrik/view/xxx/tmpl to e.g. components/com_fabrik/view/xxx_old/tmpl)
    Install Fabrik3.4+ (download from http://fabrikar.com/download or install via ExtentionManager/Install from web).

    If you are running a GitHub update grab the most recent Fabrik 3.4+ files from https://github.com/Fabrik/fabrik/tree/joomla3 - by clicking on the "download zip" button.
    You can then ftp those files to your site.

    Enable Fabrik System Plugin (if still disabled).

    Breaking change:(top)

    • Element JavaScript - we now encode the JavaScript events when we save the element. So you will need to edit and save any elements which use JavaScript actions. Tip: to quickly identify which elements have Javascript events, issue the following sql on your database (I use MijoSql from JED)
      SELECT DISTINCT element_id FROM #__fabrik_jsactions ORDER BY element_id ASC
    • Form/List JavaScript - Please ensure you use the Fabrik JavaScript template outlined here
    • Dates - we have moved to use PHP's date()format options to keep in line with a change in Joomla's date handling. You should edit your date elements and update their formatting options. Alternatively you can try this (use at own risk): (Remark: this will only remove % from date format, but there have to be some more changes, e.g.%H:%M -->H:i etc)
      Code (Text):
      $db = JFactory::getDBO();
      // Get the site configuration and make a db connection
      $Config = new JConfig();
      $connection = mysql_connect($Config->host,$Config->user, $Config->password);

      /* List all the date type elements */
      $query = $db->getQuery(true);
      $elements = $db->loadObjectList();  
      if ( empty($elements) ) {
          echo "There are no date elements";
      } else {
      $properties = array("date_table_format",
      /* Run through each element and update the formats by stripping the % */
      foreach($elements as $element) {
          $data = json_decode($element->params);
          if (!isset($data) || empty($data))
          foreach ($properties as $property) {
              if (property_exists($data, $property))
                  $data->$property = str_replace("%", "", $data->$property);
          /* renecode the data and write to the db */
          $element->params = json_encode($data);
          $query = $db->getQuery(true);
              ->set('params="' . mysql_real_escape_string($element->params,$connection) .'"' )
              ->where('id=' . $element->id);
    • Templates:
      • If you are updating to Joomla3 rename components/com_fabrik/views/list/tmpl to e.g. components/com_fabrik/views/tmpl_old (same with form) so that you won't get tmpl-folders including old F3.0 and new F3.2 templates
      • Fabrik is providing new templates using bootstrap (list: bootstrap, div; form/details: bootstrap, bootstrap_tabs)
      • Details view template are now in their own folder: components/com_fabrik/views/details/tmpl (or tmpl25 see below...)
      • So if you have selected specific templates in either
        • menu items
        • the list/form admin page
        • the module admin page
        • a content plug-in declaration
          Then you should edit and alter the templates
      • If you are still using Joomla 2.5 (with Fabrik3.2 only): the old core Fabrik3.0.x templates can be found in components/com_fabrik/views/xxx/tmpl25

    New Requirements(top)

    Sometimes there have been issues with different system plugins.
    So it's recommended to disable the Fabrik system plugin (Extensions/PluginManager), then update to Joomla3.x, then enable the Fabrik system plugin again.

    Know issues/manually to change (Dec. 2014), please add any others(top)

    • Element settings in general: Edit/Add access
    • Textarea element: truncation
    • Custom PHP code (in scripts or php code fields):
      • _formData --> formData

    Example script to update date and element settings via manual scheduled task(top)

    copy upgrade30to32.php to your-site\plugins\fabrik_cron\php\scripts\
    create a Fabrik scheduled task, type php
    select any table, select this script

    Per default it will do a testrun with debug output but without DB changes (see script for details).

    Example DB queries(top)

  • Loading...