This guide describes migration of Phoca components (Phoca Gallery, Phoca Download) from Joomla! 2.5 to Joomla! 3.x. Described migration steps can be used for other Phoca extensions in similar way (except Phoca Guestbook, which has specific guide, see below).
 
Backup all your data (old and new database, old and new files and folders) before making migration.
 
There are two parts which should be migrated:
  • Files: in case Phoca Gallery these are images and thumbnails, in case Phoca Download these are all downloadable files (preview and play files)
  • Data in database: all information about Phoca Gallery images and Phoca Download files stored in database.

 

To export/import files you will need FTP manager (or in Joomla! 3, you can use Phoca Commander - file manager)
To export/import data you will need phpMyAdmin application (runs on most webhosting servers).

 

Joomla! 2.5 (exporting site)

Be sure you have installed latest Phoca Gallery (Phoca Download) version on your Joomla! 2.5 site. If not, just upgrade to latest version on your obsolete website, in our example:
  • Phoca Gallery: 3.2.8
  • Phoca Download: 2.1.9.

 

Exporting files (Joomla! 2.5)

 

Connect to your server with FTP client and navigate to Joomla! root folder. Copy the following folders (include all subfolders and files) to your PC (to some temporary backup folder) from your server:

Phoca Gallery:
[images/phocagallery] folder
Phoca Download:
[images/phocadownload] folder
[phocadownload] folder - in case you are using your own folder for Phoca Download files, then just copy your folder.
[phocadownloadpap]
 
Now you have made backup all your files and folders from Phoca Gallery (Phoca Download).
 
 

Exporting data (Joomla! 2.5)



Login to your phpMyAdmin application, select database where all data of your Joomla! 2.5 site are stored.
 
Click on Export folder.
 
Migration - Export folder
 
Select tables you want to backup (all Phoca Gallery tables or all Phoca Download tables).
 
Migration - Export Phoca Gallery
 
Migration - Export Phoca Download
 
 


In Output settings select: Set output to a file (to store the SQL queries in file).
 
Migration - Save output to a file


In Dump table option set data (only data will be backed up, not table structure - this is important as in Joomla! 3 new columns were added. Such columns will be automatically added during installation and they will be not in conflict with exported data).
 
 
In newer version of phpMyAdmin, Dump table feature looks different. In the beginning of export process, you can select the tables to export. Right there you can set if Structure and/or Data will be exported. Select only Data to export. See image:
 


Dump tables
 
 
As Syntax to use when insterting data set both of the above.
 
 
Migration - Syntax to use when inserting data


Save the backup (SQL queries) as e.g. phocagallery.sql (phocadownload.sql). Now all Phoca Gallery or Phoca Download data of old Joomla! 2.5 site are backed up.



Joomla! 3.x (importing site)


Be sure you have installed the latest Phoca Gallery (Phoca Download) version on your Joomla! 3 site. If not, just upgrade to latest version:
  • Phoca Gallery: 4.3.10 (the latest version when this guide was written)
  • Phoca Download: 3.9.1 (the latest version when this guide was written).

 

Installing newest version in your newly created Joomla! 3.x website is necessary, so Phoca Gallery (Phoca Download or another Phoca extension) gets all the necessary database tables installed.
If you get for example this error: Table '#__phocagallery_styles' doesn't exist, this mostly means that the newest version was not installed.



Importing files (Joomla! 3)

 
Connect to your server with FTP client and navigate to Joomla! root folder and copy the following folders (include all subfolders and files) from your PC (from the temporary folder created to backup files from old Joomla! site) to your server:

Phoca Gallery:
[images/phocagallery] folder
Phoca Download:
[images/phocadownload] folder
[phocadownload] folder - in case you have set your own folder for Phoca Download files, then just copy your folder.
[phocadownloadpap]


Now Phoca Gallery (Phoca Download) should include all images (files) from your old Joomla! site.



Importing data (Joomla! 3)

 
You need to set your own database prefix. In our examples, the jos_ is used but you should use your own database prefix (be aware, it can be different for both sites, in such case you need to overwrite prefix from backed up old site to prefix used on your new site).
Example - if the prefixes are different (jos25 or jos35 are only examples):
Joomla! 2.5 used for example jos25_ prefix
Joomla! 3 will use for example jos35_ prefix
After backup and before importing SQL queries you need to replace all jos25_ strings to jos35_ strings in stored backup file. Just open the phocagallery.sql or phocadownload.sql file and replace the prefix by the table names.
 
All import actions must be done directly after installation of Phoca Gallery (Phoca Download) in Joomla! 3. All Phoca Gallery (Phoca Download) database tables must be empty before importing data from backup file.
 
Login to your phpMyAdmin application, select Joomla! 3 database.
 
Phoca Download: If you are exporting/importing Phoca Download data, before importing, you need to empty one table (to avoid conflict). Run this SQL query in your phpMyAdmin:
 
TRUNCATE TABLE `jos_phocadownload_layout`;
 
 
Migration - Truncate Phoca Download Layout table
 
 
Click on Import folder.
 
Migration - Import folder
 


Select file with backup from your disc (phocagallery.sql or phocadownload.sql).
Click on Import (Go) button.
Now all data are imported to your new Joomla! site.
 
If you find this article not complete, please inform about this in Phoca Forum. Thank you.
 

Phoca Maps Migration

See guide above, the database tables to export are:
  • jos_phocamaps_map
  • jos_phocamaps_marker
  • jos_phocamaps_icon

Files from following folder should be copied:

[phocamapskml] folder

 

Phoca Restaurant Menu Migration

See guide above, the database tables to export are:
  • jos_phocamenu_config
  • jos_phocamenu_day
  • jos_phocamenu_email
  • jos_phocamenu_group
  • jos_phocamenu_item
  • jos_phocamenu_list

There are no files to be copied.

 

Phoca Guestbook Migration

Migration of Phoca Guestbook from Joomla! 2.5 to Joomla! 3 is different to other Phoca extensions. Because Phoca Guestbook 3 (Joomla! 3) guestbooks are not stored in own table but in Joomla! categories table and ordering of Phoca Guestbook items is different in both versions.
 
Before making any changes to database, make the backup. Please be aware of your prefix. In our example, we will use standard prefix:
  • jos_ (this can be different to yours, so just change jos_ to your own prefix: yourprefix_)
  • jos_temp_ (the same here, change jos_ to your own prefix: yourprefix_temp_)
1) There are no files to be copied
2) Export only items table, there are two tables in Phoca Guestbook (Joomla! 2.5):
  • jos_phocaguestbook_books (do not export)
  • jos_phocaguestbook_items (export)

Go to your phpMyAdmin, to your Joomla! 2.5 database, click on Export (see screenshots above to locate the parts which are described here):

  • Export Method: Custom
  • Tables: select only one table - jos_phocaguestbook_items
  • Output: Save output to a file
  • Format: SQL
  • Format-specific options: structure and data
  • Data dump options: both of the above

and click Go to store (backup) file with guestbook items. Now you have exported (made backup) guestbook items. For example, its name is phocaguestbook-items.sql

4) Open this file (phocaguestbook-items.sql) and edit it, change jos_ prefix to jos_temp_ prefix (use own prefix, it is important to use the temp string there), for example:

FROM:

CREATE TABLE IF NOT EXISTS `jos_phocaguestbook_items` ( ...
INSERT INTO `jos_phocaguestbook_items` ( ...



TO:

CREATE TABLE IF NOT EXISTS `jos_temp_phocaguestbook_items` ( ...
INSERT INTO `jos_temp_phocaguestbook_items` ( ...

 

3) Go to administration of your new site (Joomla! 3) and install Phoca Guestbook 3 (in our case 3.0.2)

4) Create new guestbook in Joomla! 3. When you save the guestbook, you can see list of guestbooks - there you can see ID of your guestbook. Remember or note this ID.

Migration - Phoca Guestbook ID

5) Go to phpMyAdmin, to your Joomla! 3 database, click on Import (see screenshots above to locate the parts which are described here):

  • File to Import: browse and select phocaguestbook-items.sql
  • Click on Go

Items will be imported to your Joomla! 3 database - to temporary table (jos_temp_phocaguestbook_items). Now, in your Joomla! 3 database, there are two tables with items:

  • jos_phocaugestbook_items (made by installation of Phoca Guestbook 3, should include only one default row)
  • jos_temp_phocaguestbook_items (made by the import)

6) Run following SQL query in phpMyAdmin, in your Joomla! 3 database (be sure, you have set your prefix right):

 

INSERT INTO `jos_phocaguestbook_items` (id, catid, parent_id, lft, level, username, userid, email, homesite, ip, title, content, date, published, checked_out, checked_out_time) SELECT id+1 AS id, 10013 AS catid, 1 AS parent_id, ordering AS lft, 1 AS level, username, userid, email, homesite, ip, title, content, date, published, checked_out, checked_out_time FROM `jos_temp_phocaguestbook_items`

 

7) Update the language:

UPDATE `jos_phocaguestbook_items` SET `language` = '*';

8) Update category ID (set the ID which you have noted as guestbook ID):

UPDATE `jos_phocaguestbook_items` SET `catid` = '8';
UPDATE `jos_phocaguestbook_items` SET `catid` = '0' WHERE `id` = '1';


Now, items are imported but we need to set the right ordering, run the following SQL queries:

CREATE TABLE migrate AS
SELECT id,
@rowid:=@rowid+2 AS rowid,
@rowid - 1 AS lftnew,
@rowid AS rgtnew FROM jos_phocaguestbook_items,
(SELECT @rowid:=0) AS init
ORDER BY id;

UPDATE jos_phocaguestbook_items SET lft=(SELECT lftnew FROM migrate WHERE migrate.id = jos_phocaguestbook_items.id);
UPDATE jos_phocaguestbook_items SET rgt=(SELECT rgtnew FROM migrate WHERE migrate.id = jos_phocaguestbook_items.id);


9) Migration done, now remove temporary tables:

DROP TABLE `jos_temp_phocaguestbook_items`, `migrate`;