Developers Documentation for jUpgrade

Embed Size (px)

Citation preview

  • 7/31/2019 Developers Documentation for jUpgrade

    1/9

    Developer Documentation

    for jUpgradeVersion 1.0

    Email: [email protected]: http://www.matware.com.ar

    Contributor: Isidro Baquero - Matias Aguirre

    Date: 26/04/2011

    License:GPL/GNU

    http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/http://www.matware.com.ar/
  • 7/31/2019 Developers Documentation for jUpgrade

    2/9

    Table of Contents

    1. Introduction ................................................. ............................................... 3

    1.1. History ................................................. ............................................... 3

    2. Basics ................................................ ........................................................... 32.1. Introduction ........ .................................................. ............................ 3

    2.2. File and Directory Structure ........................................................... .. 4

    2.3. Migration process of 3rd party extensions ... .................................. 4

    2.3. JUpgrade class .................................................................................... 6

    3. XML's to update .......................................... .............................................. ..7

    3.1. Introduction ....................................................................................7

    3.1. XML Collection ................................................ ................................... 7

    3.2. XML Extension ................................ ...................................................8

    4. Building jUpgrade adapter .......................................................... .............. .8

    4.1. Adapter structure ............................................................ ................. 8

    4.2. Migration techniques ... .... .................................................. ............ 8

    4.2. Access database ... .. ............................................................. ............ 8

    5. Developer Guidelines ................................................................. ................ 9

    5.3. SVN Access ............................................... ......................................... 9

    5.4. Using SVN ...................................................... .................................... 9

    6. About the Project ................................................... .................................... 9

    6.1. Project ............................................................ ................................... 9

    6.3. Home, Forums, Developer Resources .............................................. 9

  • 7/31/2019 Developers Documentation for jUpgrade

    3/9

    Preamble

    Chapter 1. Introduction

    1.1. HistoryThis project all began when the Joomla! version 1.5 was released with a major shortcoming:

    a tool to help users migrate their data from Joomla! 1.0 to Joomla! 1.5. Although Sam Moffat

    worked on a tool like this, other tasks related to the development of Joomla! kept him

    very busy. At that point I decided to create mtwMigrator, which was widely accepted in the

    community at that time.

    With the development of Joomla! 1.6 running, I had the opportunity to help the project,

    using all the techniques learned to develop mtwMigrator. After a discussion with the

    developers I came to the conclusion that they would be too busy with Joomla! 1.6, and that

    the best way to help was to do something myself. Thus was born jUpgrade.

    Chapter 2.Basics

    2.1 IntroductionjUpgrade is a component for Joomla! 1.5. It should be installed as an extension through theextension manager. Once installed and configured on a Joomla! 1.5 site, it can be executed

    and, if everything works properly, it will perform the following tasks:

    Download the latest version of Joomla! 1.6 to your server (if you use the latest

    version of jUpgrade, this will be the latest version of Joomla! 1.6)

    Perform an automatic installation of Joomla! 1.6

    Migrate all data from the old Joomla 1.5! site to the newly installed Joomla! 1.6 site

    In principle, only the core data will be migrated 100%. For data from third-party extensions,

    jUpgrade provides the tools necessary to integrate migration schemes specific to

    each extension, which should be developed by the authors. At the time of writing this

    documentation, only Adminpraiseand Kunenahave created a plugin that allows you to

    migrate your data by jUpgrade.

  • 7/31/2019 Developers Documentation for jUpgrade

    4/9

    2.2. File and Directory Structure

    com_jupgrade| - controllers

    | - CSS

    | - extensions

    | - images

    | - include

    | `- adapters

    | - js

    | - languages

    | - Libraries

    | -

    sql`-

    `views- cpanel

    `- tmpl

    2.3. Migration process of 3rd party extensions

    When run, jUpgrade checks if the extensions installed on your system (components, modules,

    plugins and templates) have specific support for them. For this, jUpgrade looks for an

    upgrade XML file in 3 different directories in the following order:

    1. The first place jUpgrade looks is in the component/module/plugin directory. e.g.

    ROOT/administrator/components/com_kunenaor if this is a module ROOT/

    administrator/modules/mod_kunena

    2. The second place jUpgrade looks is in the front-end directory: eg ROOT/components/

    com_kunenaor if this is a module ROOT/modules/mod_kunena

    3. The third and last place jUpgrade looks is inside the jUpgrade extensions directory:

    ROOT/administrator/components/com_jupgrade/extensions

    This XML file holds the data needed to easily migrate the tables and extension files.

    The structure of the XML file is as follows:

  • 7/31/2019 Developers Documentation for jUpgrade

    5/9

    http://

    update.kunena.org/kunena16.xml

    Administrator/components/com_kunena/install/j16upgrade.php

    jUpgradeComponentKunena

    - ->

    kunena_announcement

    kunena_attachments

    kunena_categories

    kunena_config

    kunena_favorites

    kunena_groups

    kunena_messages

    kunena_messages_text

    kunena_moderation

    kunena_polls

    kunena_polls_options

    kunena_polls_users

    kunena_ranks

    kunena_sessions

    kunena_smileys

    kunena_subscriptions

    kunena_subscriptions_categories

    kunena_thankyou

    kunena_users

    kunena_users_banned

    kunena_version

    kunena_whoisonline

    media/kunena

    administrator/components/com_kunena

    components/com_kunena

    ->

  • 7/31/2019 Developers Documentation for jUpgrade

    6/9

    In the XML file we can add the options needed to migrate the extension through jUpgrade.

    This can include items like database tables, directories for media files, the updated server url

    and the category if any.

    2.4 The class jUpgradeThis class is used by the adapter for each extension that is added to jUpgrade. More

    information about this can be found inChapter4.

    In this class there are several methods that can help extension developers to migrate their

    own data.

    List of methods:

    protected function convertParams ($ params)

    protected function convertParamsHook (& $ object)

    protected function & getSourceData ($ select = '*', $ join = null, $ where = null,

    $ order = null, $ groupby = null, $ debug = null )

    protected function setDestinationData ($ rows = null)

    public function upgrade ()

    protected function cleanDestinationData ($ table = false)

    protected function copyTable ($ from, $ to = null)

    protected function clonet ($ from, $ to = null, $ drop = true)

    public function InsertCategory ($ object, $ parent = false)

    public function insertAsset ($ object, $ parent = false)

    public function saveState ()public function IsReady ()

    public function upgradeExtension ()

    protected function detectExtension ()

    protected function getUpdateSite ()

    protected function getCopyFolders ()

    protected function getCopyTables ()

    protected function migrateExtensionTables ()

    protected function migrateExtensionFolders ()

    protected function migrateExtensionCustom ()

    protected function migrateExtensionDataHook ()

    public function getPrefix ()public function getMapList ($ table = 'categories', $ section = false)

    protected function getUsergroupIdMap ()

    public function getparams ()

    public function getRequirements ()

    protected function checkTimeout ($ stop = false)

  • 7/31/2019 Developers Documentation for jUpgrade

    7/9

    Chapter 3. XML's of update

    3.1. IntroductionjUpgrade utilizes the installation/update extension system that is already included in Joomla!

    1.6. This system is accessed by accessing the Joomla! Administrator Control Panel and

    navigating to Extensions > Extension Manager > Update. From here we can click on Find

    Updates to see which extensions can be installed/upgraded.

    Once we have that list ejegir an extension and click on Update to install / upgrade.

    The upgrade system that is included in Joomla! 1.6 requires two XML's to use. One is the

    Collection XMLand the other is Update XML. These files should be in a URL accessible for all

    users using jUpgrade to migrate your Joomla! extensions.

    3.2. XML Collection

    This is the XML Collection file,which includes all extensions that can be read by jUpgrade. To

    add an extension to jUpgrade the following information should be added to this file tagged

    with 'extension' to the extension name and other attributes that are specified below:

    name = Name of the extensionelement = nameextension Joomla

    type =component / module / plugin

    version = 1.6

    detailsurl = [IMPORTANT] This attribute must point to the xml extension

    If you want to add a module to the collection:

  • 7/31/2019 Developers Documentation for jUpgrade

    8/9

    3.3. Update XMLWe must update the XML details of our extension. The most important tag in this XML is the

    downloads that lets Joomla! 1.6 know which is the file to download and install / update.

    Kunena

    Kunena for Joomla 1.6

    com_kunena

    component

    1.6.3

    http://www.kunena.org

    http://www.matware.com.ar/jfiles/com_kunena_v1.6.4 -

    DEV_b4806_2011-04-26.zip

    testing

    Matias Aguirre

    http://www.matware.com.ar/

    Testing

    Chapter 4. Building adapter jUpgrade

    4.1. Adapter structure

    Coming Soon...

    4.2. Migration techniquesComing Soon...

  • 7/31/2019 Developers Documentation for jUpgrade

    9/9

    4.3. Access databaseComing Soon...

    Chapter 5. Developer Guidelines

    5.1. SVN AccessThe jUpgrade source code is hosted onJoomlaCode. To navigate between the files you need

    to enter here:

    http://joomlacode.org/gf/project/joomla/scmsvn/?action=browse&path =% 2Fdevelopment%

    2Fbranches% 2F 2Fjupgrade%

    5.2. Using SVNTo get a copy of jUpgrade using a SVN versioning system it is necessary to run the following

    command in the console (Linux):

    svn co http://joomlacode.org/svn/joomla/development/branches/jupgrade

    For other SVN clients use the same URL:

    http://joomlacode.org/svn/joomla/development/branches/jupgrade

    Chapter 6. About Project

    6.1.ProjectJUpgradeis a project for the Joomla! Community, property of Matware, a company created

    by Matias Aguirre, author of this project.jUpgradehas a GNU license.

    6.2. Home, Forums, Developer Resourceshttp://matware.com.ar/forum/projects/jupgrade.html http://matware.com.ar/

    http://matware.com.ar/joomla/jupgrade.html

    forum / projects / jupgrade / jupgrade-faq.html