Migr J1.5 tp 3.0

Phoca Guestbook - creating guestbooks in Joomla! CMS
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Migr J1.5 tp 3.0

Post by Jan »

Hi, for now I still didn't test it so cannot give clue advice :-(

If you get "duplicate entry" error, this means, you are adding some data to table where some data exists, which is wrong. I think, the problem is that in Phoca Guestbook 3, there are no more categories, but such are taken from Joomla! category feature.

Means, the migrating is really complicated as Joomla! features changed a lot, what should be the steps:

- migrate from 1.5 to 2.5 (https://www.phoca.cz/documents/50-phoca/ ... -joomla-25)
- while migrating from 2.5 to 3 the category table needs to get specific sql queries (this really needs to be done by someone who knows SQL)

- the data needs to be exported from Phoca Guestbook Categories table (Joomla! 2.5)
- then the categories table needs to be converted to Joomla! table
- and then the import to joomla table needs to be done.

I hope, I will finish soon all the upgrading (not sure but I think, I will upgrade again for Joomla! 3.2) but then I hope I will find time for writing the migration guide from 2.5 to 3

I hope I will do it before Joomla! 3 will be stable LTS.

:-(

Jan
If you find Phoca extensions useful, please support the project
ToXiQ
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 14 Oct 2013, 19:03

Re: Migr J1.5 tp 3.0

Post by ToXiQ »

Hello Jan,

The duplicate entry I have solved. The first row from YOUR_PREFIX_phocaguestbook_items as described by info must be 1 higher then the last number from rgt field . When I do that I can add new entries without any problem.

the problem with the two fields are that it must be in this seqence:

Code: Select all

lft   rgt  
0     1
1     2
2     3
something like that. This can be done one by one but with 156 entries this is a lot of work so a sql statement who can do this would be easier. Still rebuilding the site so this is not top priority now but a nice to have workarround to keep all guestbook entries. It is pitty that phoca guestbook cant be exported to a cvs file and reimported. This would make live a lot easier for a bunch of people. Now they keep strugling with any update from joomla or forget the guestbook history and start over again.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Migr J1.5 tp 3.0

Post by Jan »

Hi, the export will not help, eporting to CSV is the same like exporting it to SQL with help of phpMyAdmin, the problem is the structure which changed, from categories to Joomla! categories :-(

And yes, you right, the numbers needs to be:

0 1, 1 2, 3 4, 5 6 (it is tree traversal system :-( )

Unfortunately, I am not on my PC now, so I cannot test it but did you test to add it without these values (rft, rgt)?

Jan
If you find Phoca extensions useful, please support the project
ToXiQ
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 14 Oct 2013, 19:03

Re: Migr J1.5 tp 3.0

Post by ToXiQ »

Hello Jan,

yes I added some entries and then I discovered this. Then I did a new import YOUR_PREFIX_phocaguestbook_items which gave me not any number. I am remember that I got once the numbers correctly but that was before I knew that the first RFT field had to be 1 higher then the last one. This weekend I am having some time over to redo everything.

I also did a rebuild from the backend which generated very high numbers in the LFT field (48XX) and leaved the RFT field with 0.

Walter
ToXiQ
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 14 Oct 2013, 19:03

Re: Migr J1.5 tp 3.0

Post by ToXiQ »

Back again.

I have migrated from phoca guestbook 1.5.3 till the latest version 3.0.0

I did everything with phpmyadmin and some sql statements

first install the latest (3.0.0.) phocaguestbook
create a new guestbook

find out which catid this one has in my case it is 13

1 - I started with copy the old YOURPREFIX-VERSION-1.5.3_phocaguestbook_items from my joomla 1.5.X database to the new joomla 3 database.

2 - backup your YOURPREFIX-VERSION3_phocaguestbook_items from the new installed phoca 3.0.0

3 -

Code: Select all

INSERT `YOURPREFIX-VERSION3_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 `YOURPREFIX-VERSION-1.5.3_phocaguestbook_items`
4 - UPDATE `YOURPREFIX-VERSION3_phocaguestbook_items` SET `language` = '*';

5 - UPDATE `YOURPREFIX-VERSION3_phocaguestbook_items` SET `catid` = '13';


so here some sql statements don with phpmyadmin:

6 - I had te renumber the LFT and RGT fields and don't forget that in the end this first entry must looking the same as you started EXEPT the RGT field!!!!

Code: Select all

create table migrate as
SELECT id
,      @rowid:=@rowid+2 as rowid
,      @rowid - 1       as lftnew
,      @rowid           as rgtnew
FROM YOURPREFIX-VERSION3_phocaguestbook_items
, (SELECT @rowid:=0) as init
ORDER BY id;
7 - then rebuild the lft with the previeus step:

Code: Select all

update YOURPREFIX-VERSION3_phocaguestbook_items 
set lft=(select lftnew from migrate where migrate.id = YOURPREFIX-VERSION3_phocaguestbook_items.id);
8 - then rebuild the rgt

Code: Select all

update YOURPREFIX-VERSION3_phocaguestbook_items
set rgt=(select rgtnew from migrate where migrate.id = YOURPREFIX-VERSION3_phocaguestbook_items.id);
then you have to look at your last entry from the guestbook and update the FIRST record from rgt with that last record number + 1.

in a previous post I mentioned that the numbering was

Code: Select all

lft   rgt  
0     1
1     2
2     3
this is not true it is:

Code: Select all

lft   rgt  
0     LATEST NUMBER + 1
1     2
3     4
5     6
7     8
Now it is working.
ToXiQ
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 14 Oct 2013, 19:03

Re: Migr J1.5 tp 3.0

Post by ToXiQ »

second part. it didn't fit in one posting:

I have some advice BACKUP FIRST
Also make first a new guestbook and get it working before you migrate. when you installed a new guestbook and that one is working you know that when it is not working the problem is in the migrate part. I did not made it working in the first place and got some troubles to get the guestbook running after migrating but when I put my backup back my newly guestbook wasn't working :-) .

when everything is working remove the migrate table and the YOURPREFIX-VERSION-1.5.3_phocaguestbook_items table.

thats all. I am sorry but I canot help with mysql problems I do not have any knowledge about mysql :o
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Migr J1.5 tp 3.0

Post by Jan »

Hi, thank you very much for the guide.

Jan
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Migr J1.5 tp 3.0

Post by Jan »

Thank you very much again for the guide, I have summarized it here:

https://www.phoca.cz/documents/50-phoca/ ... o-joomla-3

Thank you, Jan
If you find Phoca extensions useful, please support the project
dax702
Phoca Enthusiast
Phoca Enthusiast
Posts: 85
Joined: 10 May 2008, 21:11

Re: Migr J1.5 tp 3.0

Post by dax702 »

Erasing my post because I determined the problem, but not the solution.
Last edited by dax702 on 07 May 2015, 17:54, edited 1 time in total.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Migr J1.5 tp 3.0

Post by Jan »

Hi, I think, you need to ask someone who manages your site or your webhosting operator. I don't think, on your server is some specific program which somehow delete database items, so I think someone has deleted them. But first check if the posts are really deleted or not - check them in database, e.g. per phpmyadmin. Check the phoca guestbook tables.

Jan
If you find Phoca extensions useful, please support the project
Post Reply