The trackback module should scan $node->body (and extended if any) of all submitted content for urls. Then it do an autodiscovery those urls for trackback urls.

This patch also fixed a bug in that the previous autodiscovery patch where it will attempts to send tb pings to an image and thus screw up the tb. It now do a HEAD to check if the content-type is text/html before attempting to do autodiscovery.

This patch is dependent on a new table 'tb' as follow.

CREATE TABLE tb (
nid int(10) unsigned NOT NULL default '0',
pinged longtext,
toping longtext,
PRIMARY KEY (nid)
) TYPE=MyISAM;

Note: This is diff against the CVS.

CommentFileSizeAuthor
#6 trackback_2.diff10.8 KBjseng
#5 trackback_1.diff10.06 KBjseng
#3 trackback_0.diff10.03 KBjseng
trackback.diff6.9 KBjseng

Comments

drumm’s picture

Setting status. Please update the existing issue with the new patch next time.

drumm’s picture

-Use unified diff format, as described at http://drupal.org/book/view/325
-Html pages come in more mimetypes than text/html: http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/
-Using single quotes for simple strings is preferred because they are faster
+Making autodiscovery configurable
-Moderation setting appears to be unused, and probably would duplicate comment moderation (since trackbacks are comments), unless the intent was to set that bit on incoming trackback comments
-$tb_urls could easily be an array rather than building a string that is later split, or the two loops could be simply merged
+Making the trackback url advertising more clear

I would like this patch to get in, but I think it could use a little cleaning before it does.

jseng’s picture

StatusFileSize
new10.03 KB

-Use unified diff format, as described at http://drupal.org/book/view/325

done. see patch

-Html pages come in more mimetypes than text/html: http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/

those are xhtml. i havent come across any trackback:ping in xhtml..but anyway, done.

-Using single quotes for simple strings is preferred because they are faster

yes. but this seem to be inconsistent in drupal programmers. some people uses double some use single. going back to change this is a tedious task which means i have to redo all the test cases. i rather spend more time in building more codes unless there is significant performance improvement.

+Making autodiscovery configurable

it is configurable. see admin/system/modules/trackback

-Moderation setting appears to be unused, and probably would duplicate comment moderation (since trackbacks are comments), unless the intent was to set that bit on incoming trackback comments

it is configurable. see admin/system/modules/trackback

-$tb_urls could easily be an array rather than building a string that is later split, or the two loops could be simply merged

the issue is that the base of $tb_urls comes from $node->tb_url that is a form input that is a lists of tb urls separated by space or newlines (user input). the autodiscovery will generate more urls (if autodiscovery is on) and add to that lists.

so technically i cant merge the two loop.

using arrays might be a bit faster but that is subjective because that would result in three loop, rather then two. three because (a) the first one to generated $node->tb_url into an array, then (b) loop to do autodiscovery and (c) then loop to do the actual trackback

+Making the trackback url advertising more clear

do you mean the autodiscovery code? the place where it put them is from the original code. i did not change the location.

drumm’s picture

Sorry, the lines beginning with '+' were supposed to be things you were doing well.

You are right, quoting style isn't in the Drupal coding style specs, and it seems like a recent standard, but no one likes going through lots of code changing them so it hasn't been done.

Right, didn't catch the user input part for the $tb_urls. Good that you are getting multiple url ability at the same time. Might be better to parse the user input into an array and then add to that, but this looks like it should work without much of a performance difference.

This looks much improved, but the patch is backwards- there are more '-' lines than '+.' I might be able to test this once thats done.

jseng’s picture

StatusFileSize
new10.06 KB

oops! wrong way round. here is the updated patch.

jseng’s picture

StatusFileSize
new10.8 KB

okay, thanks to crschmidt and drumm, the bugs in the autodiscovery code has been (hopefully) ironed out. here is the patch.

additionally, this patch also rename the table it uses from 'tb' to 'trackback' as suggested by drumm

note that this patch also keep tracks of incoming ping in a new table called 'trackback_pingme' and then display it when people click on 'trackback_url' using comment_render().

there is a ugly kluge to set variable comment_form_location before calling comment_render() so that we wont display the comment form..a better solution in the long run is to have someway to inform comment_render() to display it or not.

jseng’s picture

Sorry, realized I didnt submt the tables needed for this patch.

--
-- Table structure for table 'trackback_pingme'
--

CREATE TABLE trackback_pingme (
nid int(10) unsigned not null,
cid int (10) unsigned not null
) TYPE=MyISAM;

dries’s picture

Who is maintaining the trackback module nowadays?

drumm’s picture

Kjartan is still the official maintainer. I have permission to commit sane patches. Ankur will be doing some coding. Cleaning up this patch should be a good starting point.

walkah’s picture

for blogapi usage, i'd appreciate adding the following information to the trackback sql table:

* pingURL (the URL of the entry)
* pingIP (the IP address of the host that sent the ping).

plus (ideally) a method to retrieve an array of

(trackback_title, trackback_pingurl, trackback_pingIP) arrays.

drumm’s picture

I think all of this has been addressed in recent versions of the trackback module.