I don't know exactly why, but TrackBack did not ping other sites at all until I applied the attached patch.
Basically, it's not required to ping other sites in a shutdown function. It is possible that TrackBack's shutdown function is overridden by Devel module's shutdown function. Anyway, I see no point for executing pings to other sites in a shutdown function. This also opens the door for showing ping results after submitting a content.
Additionally, I've removed all calls to db_lock_table() and db_unlock_tables(). I see no reason for locking tables in this module.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | trackback-DRUPAL-5.exit_.patch | 1.14 KB | sun |
| trackback-DRUPAL-5.ping_.patch | 1.64 KB | sun |
Comments
Comment #1
zorac commentedReally?
In the PHP manual, "Multiple calls to register_shutdown_function() can be made".
Comment #2
zorac commentedComment #3
sunCounter question: Are there any reasons why the code should not be cleaned up in the proposed way?
Using a shutdown_function for something that can be done immediately only complicates the script and reduces compatibility.
Comment #4
Brandon_Berg commentedDo you have the pathauto module installed? I've been running up against a similar problem as described here, and I've been able to get trackbacks to work by either disabling the pathauto module or by using your approach of calling _trackback_send directly.
Update: I think I've discovered a problem with this solution: If you try to track back to a post on the same site when initially submitting the node, then you'll send the trackback before pathauto is applied, and the trackback will end up with a URL like http://www.yoursite.com/node/1234. If you first submit the node without the trackback and then edit the node and add the trackback, it will work correctly, since pathauto will already have been applied (when the node was created).
Also, note that the forum post I link to above contains additional insight into the cause of this bug. Short version: If you have the pathauto module installed and enabled, calling _trackback_send() will result in all the nodeapi hooks being called for the "view" operation. pathauto_nodeapi calls _pathauto_include, which calls require_once() to load pathauto.inc, and for some reason this fails.
Comment #5
sunYes, I've installed Pathauto. I'd guess that most sites have.
Your findings make perfectly sense to me. I guess, one does not see an error, because the output has already been sent.
I was already a bit confused, why no one else experienced this bug. So, thanks for investigating this further!
Changing title and status accordingly.
Comment #6
zorac commented@Brandon_Berg: I've examined this problem. It seems to be a PHP's bug that the current directory has be changed in the shutdown function. I'll commit new develop version of trackback module. It's using hook_exit() function instead of the shutdown function.
Comment #7
sun@zorac: Could you please post a patch here, so we are able to test the changes before they are committed?
Comment #8
zorac commented@sun: It was committed. Please use development snapshot.
Comment #9
sunThat is considered bad practice. See http://drupal.org/patch for details about Drupal's process and guidelines about patches.
Also, your committed code looks quite weird. You've implemented trackback_exit() as a private function in trackback_nodeapi(). That will not only work by coincidence, but also does not adhere to Drupal's coding standards.
It would be great if you would adopt common practices of the Drupal community. Btw, by doing this, you will save yourself from unnecessary issues in the queue, and also allow other developers to help out in the development of TrackBack module.
Comment #10
gnassar commentedGetting white screens on any node insert or update. The error:
Cannot redeclare trackback_exit() (previously declared in /public_html/sites/default/modules/trackback/trackback.module:345) in /public_html/sites/default/modules/trackback/trackback.module on line 344
I'd create another issue, except this seems directly and inescapably related to the patch submitted due to this issue.
It is a white-screen, so tempted to up priority to critical (now that this is live in dev), but I'd imagine somebody else would've seen this by now, so it must be something unique to my configuration. Will do more digging. Don't want to submit a patch until I 1) figure out what other module is not playing nice with it or 2) I understand the logic behind making trackback_exit private, which I don't yet.
Comment #11
sunPlease test attached patch.
Comment #12
gnassar commentedYeah, after looking at it for a minute or two, I saw no reason why the declaration couldn't be placed outside the function either (as the patch does).
The five-second analysis is that it does fix the white screen. And the patch is logical, IMHO. Will report back if I run into anything interesting.
Comment #13
sunComment #14
thepanz commentedSeems to be fixed by Zorac CVS commits:
D6: http://drupal.org/cvs?commit=116148
D5: http://drupal.org/cvs?commit=116147
Re-open this issue in case of errors.
Regards
Comment #15
sunSee #9 and #11. Also look at the dates.
Comment #16
thepanz commentedYou're right Sun, I didn't check dates! :(
I committed it into latest 5.x-dev version ( but I don't have a D5 test site to test it :| )
Seems that 6.x version is already fixed (correct me if I'm wrong)
Comment #17
thepanz commentedWrong issue Status: corrected