Willkommen Gast.
Um die volle Funktionalität des Forums nutzen zu können,
müssen Sie sich einloggen oder registrieren.
Haben Sie Ihre Aktivierungs E-Mail übersehen?

 
Erweiterte Suche

30.829 Beiträge in 6.402 Themen- von 3.102 Mitglieder - Neuestes Mitglied: Yohana

24-09-2017 01:28:46
JOOM::GALLERY::FORUMJoomGallery 3.x JUXMigrationMy Gallery2 Migration
Seiten: [1]
Drucken
Autor Thema: My Gallery2 Migration  (Gelesen 1216 mal)
0 Mitglieder und 1 Gast betrachten dieses Thema.
sachiel
Newbie
*
Offline Offline

Beiträge: 5


« am: 05-02-2014 18:37:14 »

I just thought I would share my experience moving 8007 photos from a Gallery2 installation to JoomGallery3.  Goals were to import all images (titles and descriptions), all categories and preserve file structure.  Users, votes and comments were unimportant and discarded. 

First step was to dump and import the following tables from my Gallery2 database to my Joomla database.  I left the g2 prefix alone:

g2_AlbumItem
g2_ChildEntity
g2_Entity
g2_FileSystemEntity
g2_Item
g2_PhotoItem

Then, the /g2data folder needs to be moved into the <site>/images folder, so <site>/images/g2data and everything under it.  Once moved, you need to delete, rename or disable the .htaccess in the /g2data folder.

I had to reconstruct the complete file path for each file for the import, and to do that, I created a user defined function on my mysql server and incorporated that into my query for images.  I'm sure there is a way to do this in PHP, but I'm very comfortable working with functions/procedures in sql, so opted for this instead.  Here is the UDF:

Code
CREATE FUNCTION `fn_LoopPath`(`varId` INT(11)) RETURNS varchar(1000) CHARSET utf8
   READS SQL DATA
   SQL SECURITY INVOKER
BEGIN
 
DECLARE varParentId INT(11) DEFAULT 1;
DECLARE varPath VARCHAR(128) DEFAULT '';
DECLARE varRetPath VARCHAR(1000) DEFAULT '';
 
 
WHILE (varPath IS NOT NULL) DO
 
SELECT a.g_parentId, b.g_pathComponent
INTO varParentId, varPath
FROM g2_ChildEntity a
INNER JOIN g2_FileSystemEntity b ON a.g_id = b.g_id
WHERE a.g_id = varId
LIMIT 1;
 
SET varId = varParentId;
 
IF (varPath IS NOT NULL) THEN
 IF varRetPath != '' THEN SET varRetPath = CONCAT('/', varRetPath);
END IF;
 SET varRetPath = CONCAT(varPath, varRetPath);
END IF;
 
END WHILE;
 
RETURN varRetPath;
 
END

With the tables and UDF in place, you'll need a clean JoomGallery install and to install the migration plugin.  I modified the provided Phoca conversion migration script to suit my needs.  The Gallery2 I was importing also had BBCode in the title field, which I had to strip out, put in the description instead and if replace with the file name if the title was then blank. I am sure there is room for improvement such as including the creation date, but I'll leave that up to anyone to include.

I choose JoomGallery over others for my gallery component because of it's great API's, both migration and incorporation into other components.  Thanks to the dev's for making this easy and I hope this helps someone move their 10 year old Gallery2 instance into this great component.
« Letzte Änderung: 05-02-2014 18:42:49 von sachiel » Gespeichert
puoskari
Newbie
*
Offline Offline

Beiträge: 2


« Antworten #1 am: 29-06-2017 00:22:23 »

I'm trying to get this udf added to MariaDB 10.1.13 on xampp and windows 10, but I'm not rally sure how it should be done. So far I have followed this guide to compile MariaDB and now I tried to follow this guide, but you udf code looks different from the rest of the functions in udf_example.c. Could anyone help and point me to the right direction?
Gespeichert
puoskari
Newbie
*
Offline Offline

Beiträge: 2


« Antworten #2 am: 29-06-2017 01:05:37 »

Nevermind. Guess it wasn't actually an udf. This guide seemed to work.
Gespeichert
Seiten: [1]
Drucken
Gehe zu:  

HOSTED BY SCHWARZKÜNSTLER ®

PROTECTED BY  ZB BLOCK  AND Project Honey Pot
Theme orange-lt created by panic

Bad Behavior has blocked 1450 access attempts in the last 7 days.