Migrating from J 2.x / Fabrik 3.0

  • Views Views: 16,572
  • Last updated Last updated:
  • Upgrade instructions​


    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 https://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:​

    • 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:
      <?php
      $db = JFactory::getDBO();
      // Get the site configuration and make a db connection
      $Config = new JConfig();
      $connection = mysql_connect($Config->host,$Config->user, $Config->password);
      mysql_select_db($Config->db,$connection);

      /* List all the date type Elements */
      $query = $db->getQuery(true);
      $query
      ->select('*')
      ->from('#__fabrik_elements')
      ->where('plugin="date"');
      $db->setQuery($query);
      $Elements = $db->loadObjectList();
      if ( empty($Elements) ) {
      echo "There are no date Elements";
      } else {
      }
      $properties = array("date_table_format",
      "date_form_format",
      "date_time_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))
      continue;
      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);
      $query
      ->update('#__fabrik_elements')
      ->set('params="' . mysql_real_escape_string($element->params,$connection) .'"' )
      ->where('id=' . $element->id);
      $db->setQuery($query);
      $db->execute();
      }
      ?>
    • 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​

    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​

    • 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​

    upgrade30to32.zip
    unzip
    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​

    http://www.fabrikar.com/forums/inde...-for-upgrading-from-f-3-0-x-to-f-3-3-x.41692/
Back
Top