Page 2 of 3

Posted: Fri Jan 04, 2008 5:12 pm
by ReLight
garvinhicking wrote:Hi!
> Tried, no good.
Hm, can you modify it to:

Code: Select all

            if ((int)$phpbb_mirror === 3) {
                $phpbb_mirror = 3;
die('3!');
            } elseif ((int)$phpbb_mirror === 2) {
                $phpbb_mirror = 2;
die('2a!');
            } elseif (serendipity_db_bool($phpbb_mirror)) {
                $phpbb_mirror = 2;
die('2b!');
            } else {
                $phpbb_mirror = false;
die('0!');
            } 
And see with which message it dies?

>it dies with 0!

Anonymous posting from the webinterface without registration is disabled at my phpbb forum. (who ever has that still turned on?), that might be it.
Would be nice if you could test it. It's really required to not use a fixed username.
but as these are direct db inserts thats not prevented. I guess there is a double post-rights lookup making sure non registered users can not show posts even if they hack direct into the db.
That would be a new feature of phpb3 then, which I don't think is really useful in our usage scenario. There must be a way to circumvent that, or else you would never know who commented what on your phpbb forum!

:D

Fixed if you change the -1 on line 2757 to 1. The the name is also the one entered in the comment form.
They changed the numbering in the users table., anonymous is now poster_id 1 (I do wonder if this only appies for new phpbb3 setups and what happens to upgraded ones).
The -1 in the old script was converted to 0 every time on insert.


--
2 issues remain now:

1- phpbb version detection (bug)
2- comments added in phpbb - show in s9y as 'anonymous' posts. (Feature ?)

Posted: Mon Jan 07, 2008 6:37 pm
by garvinhicking
Hi!

Fixed it all in version 0.29 of the plugin. You might need to re-open the configuration page and save the config values so that the phpbb 3.x detection works.

Regards,
Garvin

Posted: Mon Jan 07, 2008 11:29 pm
by ReLight
Great !

Its not online I see (site or spartacus) but i'll snatch it asap.

Posted: Tue Jan 08, 2008 2:16 am
by Don Chambers
You can always download direct from cvs: http://php-blog.cvs.sourceforge.net/php ... ent_forum/

Posted: Tue Jan 08, 2008 9:03 pm
by ReLight
0.29 tested and works fine with phpbb3.

issues remaining:
1- comments added in phpbb - show in s9y as 'anonymous' posts.
2- Initial article from s9y to phpBB3 has lastposter-id = guest-id when no comments have been given. (cosmetic issues more or less), this should be the same as the poster-id configured in the plugin properties.

Addition:
3-php3 entered comments only show in s9y-site if minimal 1 s9y comment was made. (critical bug).

Do you want to go on and improve it all Gavin ?

Posted: Tue Jan 08, 2008 11:32 pm
by garvinhicking
Hi!
ReLight wrote:0.29 tested and works fine with phpbb3.

issues remaining:
- comments added in phpbb - show in s9y as 'anonymous' posts.
- Initial article from s9y to phpBB3 has lastposter-id = guest-id when no comments have been given. (cosmetic issues more or less), this should be the same as the poster-id configured in the plugin properties.

Do you want to go on and improve it all Gavin ?
I agree, those things are left. I'm out of time for this week, so maybe if you have time to fix it,please go ahead and contribute your patch.

Else I'll try to look into it at the end of next week.

Regards,
Garvin

Posted: Wed Jan 09, 2008 10:42 pm
by ReLight
issue (2): Initial article from s9y to phpBB3 has lastposter-id = guest-id when no comments have been given.


replace in line 2561
, 0 , 0
with
,$topic_poster,$topic_poster

Posted: Thu Jan 10, 2008 12:12 am
by garvinhicking
Hi!

Thanks, committed that change.

Regards,
Garvin

Posted: Mon Jan 14, 2008 12:21 am
by ReLight
OK.

Can't make head or tails yet of bug#3:
phpBB3 entered comments only show in s9y-site if minimal 1 s9y comment was made. (critical bug).

Without an original s9y comment it does not seem to trigger the case 'fetchcomments' of the event_form plugin.



>update: seems that without an entry in the s9y comment table the comments are not retrieved at all for articles.

Posted: Wed Jan 16, 2008 12:33 am
by ReLight
Up2:
Well I know a workarround now, basically in the event when phpbb mirror is on and an article is created or saved just add the referal comment table entries so it always looks at phpbb for its comments.
Just need you Gavin to put it in as I can't get the if statement to work with serendipity_db_query for some reason.

In event_forum_plugin.php at the backend_save,backend_publish case
below the code block that updates an forum enty after a s9y article update and the code block that inserts a new forum entry .


pseudo code:

Code: Select all

$COUNT=serendipity_db_query(SELECT COUNT(*) FROM {$serendipity['dbPrefix']}comments WHERE entry_id=".(int)$eventData['id']
);

if($COUNT==0){
serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}comments (entry_id, title, url, type, status, subscribed)
                                                   VALUES (" . (int)$eventData['id'] . ", 'phpbb_mirror','".$r['phpbb_url']['value']."', 'NORMAL', 'approved', 'false')");
}
The if statement is meant to prevent double entries in the s9y comment table for an article entry_id, but I have trouble getting this working.

for this to work the phpbb_url value must also be rerieved with replacement query:

Code: Select all

$r = serendipity_db_query("SELECT value, property
                                                     FROM {$serendipity['dbPrefix']}entryproperties
                                                    WHERE entryid = " . (int)$eventData['id'] . "
                                                      AND (property = 'phpbb_topic' OR property = 'phpbb_post')", false, 'assoc', false, 'property');
to:

Code: Select all

$r = serendipity_db_query("SELECT value, property
                                                     FROM {$serendipity['dbPrefix']}entryproperties
                                                    WHERE entryid = " . (int)$eventData['id'] . "
                                                      AND (property = 'phpbb_topic' OR property = 'phpbb_post' OR property = 'phpbb_url')", false, 'assoc', false, 'property', false, 'property');

Posted: Wed Jan 16, 2008 4:07 pm
by garvinhicking
Hi!

Hm, I don't really undertand the basic problem.

Could you tell me what I need to do to reproduce the error? Something like:

1. Create an entry
2. Comment on the blog
3. Install the forum plugin
4. Comment on the entry again
5. Bug comes: Comments cannot be fetched

Regards,
Garvin

Posted: Wed Jan 16, 2008 11:11 pm
by ReLight
1 install the plugin with phpbb mirror
2 create an article in s9y
3 goto the forum to the mirrored article
4 post an reply in phpbb on the article
5 goto s9y to the article created in #2
6 -> bug: the comment-reply made in phpbb is not visible in s9y website

7 Now in the s9y site in the article created in #2 maken an s9y comment
8 _> Now suddenly both 1. phpbb comment is visible and the 2. s9y comment as well.


my solution was to see what kind of db entry was made at s9y comment insertion in the db in the s9y comment table. And just insert that row at initial article creation (backend-save case) in the event-plugin in stead of waiting for the first s9y comment to insert it.

more clear this way ?

Posted: Thu Jan 17, 2008 4:14 pm
by garvinhicking
Hi!

Ah, now I can reproduce it.

Hm, the problem is, I don't know if it can be properly fixed. Your fix actually inserts a fake comment, right?

Serendipity does not execute the "fetchcomments" routine, because it does not yet have any comments. Serendipity could only do that, if when a phpbb entry is posted, the s9y database would be updated. The s9y plugin cannot be executed at this point, so it never is aware of foreign comments, unless serendipity comments are fetched.

The only way to fix it would be to always look up the phpbb mirror when an entry is viewed, and then also a second time to fetch those comments. Sadly this means that a change in the s9y core is required, inside the include/functions_comments.inc.php file.

I've committed both fixes:

http://svn.berlios.de/viewcvs/serendipi ... 83&r2=2092

http://php-blog.cvs.sourceforge.net/php ... 27&r2=1.28

HTH,
Garvin

Posted: Thu Jan 17, 2008 11:34 pm
by ReLight
\yes yhats the problem, Your fix will do it nice

But i thought of another way to fix it, within the forum_event_plugin (although it is an hack).

The result is the same i posted above: Insert a single fake comment containing the phpbb reference into the comment table.

If you setup the fake insertion into the forum_event_plugin under the backend_save case it would:

a) only be inserted fake if the phpbb mirror option was enabled at initial article creation
c) you can prevent double inserts for the same article (that if statement was what I could not get working)
b) de fix would be confined to the plugin.


To be complete the fake insert should happen in 2 cases:
a) at initial article creation
b) at article update


Update:

I tested your fix for good order, and it works fine ! :D Another issue seems to be cleared as well. If you removed comments in phpBB, in s9y the reaction count was not lowered. It seems to do that now as well.

Posted: Fri Jan 18, 2008 11:24 am
by garvinhicking
Hi!

You are right, but I disliked that fake comment routine because it introduced nasty duplication checks. Instead I wanted to do it properly, so that comments are properly fetched even without them...that's the only clean fix that won't lead to followup errors :)

Regards,
Garvin