Page 1 of 1

New posts show up as replies - After Importing

Posted: 27 Jul 2014, 03:37
by rdwilson
I did a migration from Joomla 1.7 to 3.22 as outlined in the post here:
viewtopic.php?f=2&t=23105&start=10

Everything seems to be working OK except all new posts have the "parent id" of the last post making them show up as replies. I am probably overlooking something simple but I have spent many hours trying to fix this.


Since I am not allowing replies, I could probably write a cron job to set the database field "parent id" to "0" as a work around. But that is not the most desirable solution.

EDIT- The "user id" in all records is set to "0". Could this be the problem?

Re: New posts show up as replies

Posted: 29 Jul 2014, 00:01
by rdwilson
OK I created two PHP scripts to try and fix this issue.
1. db-connect.php

Code: Select all

<?php
// set db access info as constants
define ('DB_USER','username');
define ('DB_PASSWORD','pw');
define ('DB_HOST','localhost');
define ('DB_NAME','dbname');
// make connection and select db
$dbc = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
mysql_select_db(DB_NAME) OR die ('Could not select the db: ' . mysql_error() );
?>
AND
2. gb-fix.php

Code: Select all

<?php
require_once('../db-connect.php'); // connect to db
$query = "UPDATE `YOURPREFIXHERE_phocaguestbook_items` SET `parent_id` = '0'";
$query = "UPDATE `YOURPREFIXHERE_phocaguestbook_items` SET `level` = '1'";
$result = @mysql_query($query); // run the query
?>
gb-fix.php is being called by cron and this works but the ordering is still not correct. The new post still appears BELOW the latest post.

I think that I do not have an understanding of the "lft" and "rgt" fields. I tried setting the first record's "rgt" value to the "last record value +1" as suggested in the migration post but that didn't seem to make any change.

Can some one enlighten me?

Re: New posts show up as replies

Posted: 30 Jul 2014, 15:30
by Jan
Hi, "lft" and "rgt" are Joomla! values for tree traversal function - this means, these numbers says which file/category is next or previous to each other - in one tree. This method "tree traversal function" is alternative to "recursive function" and it should help to load tree of categories quicker and with less memory demands.
Phoca Guestbook now uses the category system of Joomla!, no its own - in Joomla! tree traversal system is used but in Phoca Guestbook recursive function was used - this is the problem during migrating from 1.x to 3 :-( (I hope I will write soon migration guide for this)

Parent ID is ID of the guestbook.

1 post has lft 1, rgt 2
2 lft 3 (continuing from rgt 2 by previous post) and rgt 4 - next post will get lft 5 and rgt 6

Parent ID will be still the same.

Jan

Re: New posts show up as replies

Posted: 30 Jul 2014, 19:56
by rdwilson
Hi Jan -

Thanks for the reply and information. I will look further into this and post a solution if I find one.

My plan is to reinstall Guestbook after removing the MySQL tables. I will then make some test entries to better understand the structure. I will then try to match it and re-import the old posts.

What's strange is that the imported data looks fine and displays properly but any attempt at entering a NEW post is being interpreted as a reply to the latest imported entry.

Rick

Re: New posts show up as replies

Posted: 31 Jul 2014, 00:25
by rdwilson
I found my error that was causing the new posts to show up as replies. I was following the instructions in this thread:
viewtopic.php?f=2&t=23105&start=10

Image
SOLVED!

However, now when I enter a new post, it shows up somewhere near the earliest imported posts. :x
Image

Perhaps I will just make a guestbook called "Archives" for the imported entries and a second guestbook for all new posts.

Unless, of course, there is a solution that will work. :wink:

Re: New posts show up as replies - After Importing

Posted: 23 Mar 2015, 22:28
by zerofield
Hi my recent post might be of your interest if you're still experiencing the issue with new posts getting listed at the end of the database.
viewtopic.php?f=2&t=28568

Kind regards

Re: New posts show up as replies - After Importing

Posted: 26 Mar 2015, 21:34
by Jan
Hi, thank you for the info, in this case I just follow the Joomla! ordering features here, so for now I really don't have any solution to somehow join old posts and the new one, so maybe the solution with "archives" will be the best solution for now :-(

Jan

Re: New posts show up as replies - After Importing

Posted: 02 Dec 2015, 19:01
by superbobo75
I have the same problem, and I found that when I add a new item, for example, gets the number 7 and 8. Then sort through the MySQL admin preview table by RGT, I have, for example, under this new old item that has the number 10 and 11. After adding another click again to look into MySQL admin, original old item has a place 10 and 11 numbers, number 12 and 13, and a new post 9 and 10.

To make it work I need to shift the numbers RGT, but complement the currently highest in a series that is. What am I supposed to do?

I followed the instructions - migration was 9/2015, ie according to current migration points. Unfortunately, I discovered the mistake after it has been added other items but now under the new Joomla. Thus, the table can not be erased and re-migrate.

Page with instructions:
https://www.phoca.cz/development/50-joom ... o-joomla-3

Page with instructions:
https://www.phoca.cz/development/50-joom ... o-joomla-3

Česky:
Mám stejný problém a zjistil jsem, že když například přidám novou položku, dostane číslo 7 a 8. Poté seřadím přes MySQL admin v náhledu tabulku podle RGT, mám například pod touto novou položkou starou, která má číslo 10 a 11. Poté co přídám další položku a znovu se podívám do MySQL admin, původní stará položka má místo 10 a 11 čísla, číslo 12 a 13, a nový příspěvek 9 a 10.

Aby to fungovalo potřebuji aby se neposouvali čísla RGT, ale doplňovali se aktuálně nejvyšší co v řadě je. Co mám pro to udělat?

Postupoval jsem podle návodu - migrace proběhla 9/2015, tedy podle aktuálních bodů migrace. Bohužel, chybu jsem zjistil až poté, kdy byly přidány další položky ale již pod novou joomlou. Nemůžu tedy tabulku vymazat a znovu migrovat.

Stránka s postupem:
https://www.phoca.cz/development/50-joom ... o-joomla-3

Re: New posts show up as replies - After Importing

Posted: 12 Dec 2015, 02:29
by Jan
Ahoj, problém je, že já to nějak nemůžu nasimulovat, já jsem to dělal podle toho návodu a pak mi to jelo vše normálně. Vím o tom problému ale nevím jak ho vyřešit, protože ať simuluju jakkoliv, tak mi to podle toho návodu jede normálně.

Jediný co mě napadá, je, že při migraci se nějak špatně vytvořili údaje pro rgt a lgt :idea: