– Note 1: This post is about migrating modules’ data (such as settings, content, etc…) – it’s not about migrating the actual code. This post comes to help when you have lots of modules on your Joomla 1.5 website, and you don’t have time to manually migrate all the data for all these modules.
– Note 2: This post is very technical and a bit advanced, if you’re not a programmer and if you don’t have experience in database queries, then we suggest that you email this post to your programmer to do the below for you – or even better – contact us to do it for you ourselves!
– Note 3: This post assumes that you have access to phpMyAdmin and you know how to use it. If you don’t, then again, either forward it to your developer/system administrator or let us do it for you.
– Note 4: This post is somehow similar to our previous post on migrating users from Joomla 1.5 to Joomla 2.5 – except that the latter is about migrating users.
The funnest part, in our opinion, in a Joomla migration project, is migrating modules (the second funnest is migrating the template). It’s only when you migrate the modules that you see the website becoming (errr) a website, again! However, the task of migrating modules is usually not an easy task and it consists of two parts:
- Migrating the actual code for each and every module.
-
Migrating the data for each and every module.
Migrating the module’s code is too specific and there is no silver bullet for such a migration. On the other hand, migrating the modules’ data, including the settings, the ordering, and the placement, is an easy task if you have access to phpMyAdmin. Let us explain, in a few easy steps, how to do this:
- Login to phpMyAdmin
Logging in to phpMyAdmin can be typically done from your hosting account and the process varies depending on your environment. If you have troubles accessing phpMyAdmin, then you should contact your hosting provider.
-
Select the database of your old Joomla website
The name of the database of your old Joomla website can be found in your configuration.php file. (It is the value of the $db variable).
-
Run the below query
Click on SQL (in phpMyAdmin) and run the following query:
SELECT `id`, `title`, `content`, `position`, `ordering`, `module`, `published`, CASE WHEN access <= 1 THEN 1 ELSE access END AS `access`, `showtitle`, `params`, `client_id`, '*' as `language` FROM `jos_modules` WHERE `published` = 1
Some observations on the above query:
- Notice the condition on the access field - this is because an access field that has a value of 0 in Joomla 1.5 must have a value of 1 in Joomla 2.5.
-
We are adding the language field (that doesn't exists in Joomla 1.5) and we are giving it a value of *, which means that the module is available in all languages (if this is not the behavior that you want then you need to modify the query to accommodate your needs).
-
We are filtering out non-published modules. If you don't want that then run the following query instead:
SELECT `id`, `title`, `content`, `position`, `ordering`, `module`, `published`, CASE WHEN access <= 1 THEN 1 ELSE access END AS `access`, `showtitle`, `params`, `client_id`, '*' as `language` FROM `jos_modules`
-
Export the results of the query
This can be done by scrolling down the query results page (after running the query above), and clicking on the Export link under Query results operations. Once you click on the button, you will be redirected to another page, on which you should do the following:
- Choose Custom as Export Method.
-
Click View output as text under Output.
-
Click on Go at the very bottom of the page and finally copy the exported data (by pressing Ctrl+a and then Ctrl+c on the window containing the exported data).
-
Prepare the data to be imported
Now that you have exported the data, you will need to prepare it for importing. All you need to do is to apply the following to the exported data:
- Replace all references to jos_ with the table prefix of your Joomla 2.5 website (the table prefix can be found in the configuration.php file of your new Joomla website).
-
Replace the first line from:
INSERT INTO `[table_prefix]modules` (`id`, `title`, `content`, `position`, `ordering`, `module`, `published`, `access`, `showtitle`, `params`, `client_id`, '*') VALUES
to:
INSERT INTO `[table_prefix]modules` (`id`, `title`, `content`, `position`, `ordering`, `module`, `published`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES
Note that there might be several references to the above query in the exported data - the number of these references is proportional to the size of your modules table.
-
Import the modules' data into your new website
Now you need to import the modules' data to your new Joomla website. All you need to do is the following:
- Select the database of your new Joomla website.
-
Click on SQL (located on the top of the page) and paste the modified exported data, and then click on Go at the bottom.
-
That's it! Assuming everything went well, you have successfully migrated your modules' data from Joomla 1.5 to Joomla 2.5! Congratulations!
Now it is important to mention that the above process will not migrate the associations of the modules to the menu items. This is a much more complex process and it's outside the scope of this post. If you need help doing this, then please contact us. Our fees are very competitive, our work is very fast, and our results are always satisfactory to our clients!
Wondered if you could tell me — I have made changes to a clone of a website via settings of individual modules (including turning them on and off and position) and I want to migrate these settings over to the original (still 1.5 joomla) without clobbering any of the content of the website itself (many stories have been published since then.
Will this query accomplish this — what is meant by the “content” of the modules above?
Thanks so much,
Bryan
Hi Brian,
The content is a field in the #__modules table. The content field usually holds the content of custom HTML modules, as well as content of some other modules (such as codebox).
The settings you are talking about are in the params field, and yes they will be migrated.