Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
ping.module
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
7 Nov 2005 at 15:48 UTC
Updated:
2 Oct 2006 at 16:10 UTC
Jump to comment: Most recent file
Abstract:
The ping.module requires a site slogan to work. This shouldn't be, since a site slogan is not mandatory.
Details:
The ping.modules fires a ping only if the following condition is met (function ping_cron()):
if (variable_get('site_name', 0) && variable_get('site_slogan', 0)) {
... Check for update and ping ..
}
No ping is done, if either site_name or site_slogan is empty.
Solution:
I suggest to introduce a function _ping_get_full_site_name() like this:
function _ping_get_full_site_name() {
$ret = variable_get('site_name', '');
if (!empty($ret) && variable_get('site_slogan', 0)) {
$ret .= ' - ' . variable_get('site_slogan', '');
}
return $ret;
}
And use it in ping_cron():
function ping_cron() {
global $base_url;
$sitename = _ping_get_full_site_name();
if (!empty($sitename)) {
if (db_num_rows(db_query("SELECT nid FROM {node} WHERE status = 1 AND moderate = 0 AND (created > '". variable_get('ping_cron_last', time()) ."' OR changed > '". variable_get('ping_cron_last', time()) ."')"), 1)) {
_ping_notify($sitename, $base_url);
}
}
variable_set('ping_cron_last', time());
}
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | ping-no-slogan.patch_3.txt | 873 bytes | breyten |
| #15 | ping-no-slogan.patch_2.txt | 1021 bytes | breyten |
| #12 | ping-no-slogan.patch_1.txt | 907 bytes | breyten |
| #10 | ping-no-slogan.patch_0.txt | 1.04 KB | breyten |
| #8 | ping-no-slogan.patch.txt | 1.04 KB | breyten |
Comments
Comment #1
breyten commentedpatch attached that removes the need for the slogan, by including it only optionally.
Comment #2
breyten commentedTo clarify a little, I did not do what the original poster suggested, but just added a few lines.
Comment #3
breyten commentedStill applies, updating status since this is a simple patch (and hopefully it will get on the radar of some more people).
Comment #4
dries commentedThat's by design, and documented on the drupal-setting page.
Comment #5
gerd riesselmann commentedHmm, where exactly is this documentated? The drupal-settings page (if this is www.example.org/admin/settings) only states that
There is no setting page for the ping.module, at least not for version 4.6, and the behavior also isn't mentioned in the handbooks, neither within section "Configuration and customization - Configuration - Settings", nor within the documentation of the ping.module.
Comment #6
dries commentedSee the form description at 'admin/settings/drupal'.
Comment #7
breyten commentedDries, this isn't about pinging drupal.org (or any other drupal site that has a Druapl Directory), but this is about sites pinging ping-o-matic.com (and technorati.com). Would they still need to require a site slogan for that sort of pinging? If so, why? It doesn't seem to make sense to me.
Comment #8
breyten commentedChanged the title to reflect the issue better, and updated the acompanying patch.
Comment #9
drumm+1 Code looks okay to me. (leaving for Dries to decide on comitting)
Comment #10
breyten commentedKeeping up with CVS...
Comment #11
dries commentedCommitted to CVS HEAD. Thanks! :)
Comment #12
breyten commentedSomething definitely went wrong when applying the patch though. Currently, it's broken. New patch attached.
Comment #13
breyten commentedUh, forgot to update status.
Comment #14
drummLets keep the site slogan default consistent, use
''instead of 0. Since we are checking to see if there are characters in a string, it is best to be explicit and saystrlen(...) > 0in if statments.Comment #15
breyten commentedThat's a good idea. using that for the title too now.
Comment #16
dries commentedLet's not append the slogan. That part was removed intentionally.
Comment #17
breyten commentedAhhh :) Well that simplifies the patch a lot :)
Comment #18
dries commentedAFAIK, we never use strlen to check if a value (variable_get) is set ... maybe this is a valid case, but please double-check this. Thanks.
Comment #19
breyten commentedDouble check. But the check is actually superfluous, since the default site title is 'drupal' and the settings page doesn't allow you to set an empty title (albeit one with spaces though).
Comment #20
drummI like using strlen() since it makes the fact that it is a string explicit.
BUt thats beside the point since the default value is either 'Drupal' or 'drupal' everywhere else, and should be this here. For example, I save that form without touching the name for plenty of test sites and such a test site would evaluate this test to true. It should be variable_get(...) != 'drupal'.
A separate patch can make the case of all these 'Drupal's and 'drupal's consistent if anyone is motivated enough to do it.
Comment #21
dries commentedAFAIK, this has been fixed by another issue.