For over half a year ago I wanted a module for pinging sites and found Multiping - but I was unsure about the quality of the dev verison for Drupal 6 and didn't like the coding style of the code - so I did some changes.

Attached is a patch of a quite extensive coding style cleanup and some other improvements. It has been published in a git-repo for quite some months now - waiting for me to make it ready for the issue queue, but I haven't had time so the patch I now post is the raw fix that I myself is using on my site.

The originating git-repo can be found here: http://github.com/voxpelli/drupal-multiping/tree/master

Comments

jonathan1055’s picture

Hi,
I will try to review your changes. I have also made a whole load of improvements for my site, but not given any patches because the module board seemed very quiet. I expect we have done alot of the same work, so that is my fault for not getting patches up here.

It would be good to get a fully stable tested official D6 release. I'm sure we can do it.

Jonathan

voxpelli’s picture

Nice Jonathan - looking forward to your patches!

jonathan1055’s picture

There were 16 open issues, but I have just closed some of the really old (over 1 year) ones which did not have anything other than the opening post, and which would appear to be out of date now anyway.

When we can get this board down to a level with only current issues and patches, then it looks much more like a current active module. We then know what we are dealing with and new visitors will be able to contribute to the latest developments.

voxpelli’s picture

Good idea - I will go through them as well

voxpelli’s picture

I've updated #232400: Update MultiPing to Drupal 7 - I think we should continue our discussion there if it regards the fix of the Drupal 6 port in general and in #537962: The future maintainership of Multiping if it regards new maintainers for this module.

Does that sound like a good idea to you?

jonathan1055’s picture

Fine

jonathan1055’s picture

Status: Needs review » Needs work
StatusFileSize
new26.39 KB

Good work, voxpelli. You have made lots of improvements for standards and readability.

I checked the pacthed files against coder and found a couple of 'else if' which I have changed to 'elseif' (line 33 and 200 in .module). Then I checked with /scripts/code-style.pl because I have found that this detects some things that coder does not yet do (see #484566: Operator spacing), and found two more things to fix, which were adding spaces around == in line 133 and adding the required braces around the IF statement on line 194.

For the .install file I added the $Id$ line needed for cvs, an @file description and header blocks for each of the functions. Attached is patch which includes all your work plus these few new changes.

I tried a fresh install and the multiping table was re-created ok but the initial row for pingomatic did not get inserted. I tested the code separately after install and both the creation of the $pingomatic object and the drupal_write_record worked fine. So I debugged during another installation run and it appears that the multiping schema is not installed at that point, so $schema = drupal_get_schema($table) returns nothing, hence drupal_write_record returns without doing anything. Is there a way to force the results of drupal_install_schema() after calling it in hook_install such that the schema can be used later in hook_install? That may be a question for the support forum. If there is not an easy way then we may need to go back to doing a plainer slq query instead of drupal_write_record.

Jonathan

voxpelli’s picture

StatusFileSize
new26.56 KB

Apparently there's a problem with drupal_install_schema() not clearing the cache in drupal_get_schema(). I added a new line to the code, based on your patch, that clears the cache between our call to drupal_install_schema() and our call to drupal_write_record().

Attaching a new patch.

voxpelli’s picture

Status: Needs work » Needs review
jonathan1055’s picture

Looks good. Before seeing your post I spent an hour on the train today following through the logic of drupal_get_schema, and I also tried an additional call to drupal_get_schema('multiping', TRUE) in an attempt to rebuild the static variable $schema, but this still did not work. It calls module_implements('schema') but this does not return multiping at this point. I then tried an additional call to module_implements('install',true,true) which is supposed to refresh the list. Still no multiping is returned. Is this becaue the module is not enabled yet, ie status is not 1? That's as far as I got, so not flushed out the ultimate cause yet.

Maybe I was doing something wrong and your change with drupal_get_schema(NULL, TRUE) will work. I've not got time to test this at the moment because I am off on holiday tomorrow morning, but I will get on to it the following week, if no one else has tested and passed it.

Jonathan

voxpelli’s picture

I didn't try the patch either and I was too fast to find a fix - i looked at #200931: Schema not available in hook_install/hook_enable and thought it would work in hook_install() but I now see that it only works in hook_enable().

I think the best would be to not use drupal_write_record() then and instead insert the code through our own query as was done before.

jonathan1055’s picture

StatusFileSize
new26.77 KB

Thanks for the link to that post, it was useful. After making my comment in #10 I was wondering about hook_enable. I think that doing a forced schema reload in multiping_enable is probably the best idea, as this allows us to use drupal_write_record, and maintains the database abstraction layer which is important if Multiping is going to become a fully compliant module.

Before inserting the default record I have checked that the table is empty, ie if the admin disabled the module but did not uninstall it before re-enabling then we dont want to add the record again.

I have made these changes and created a new patch based on everything we've done so far from the existing dev release.

Jonathan

proindustries’s picture

Hey guys - glad to see people started working on a d6 update. Any recent progress? Happy to QA test if you have anything worth testing?

jonathan1055’s picture

Hello John,
Thanks for your interest. Unfortunately it has gone a bit cold because there's been no activity on #537962: The future maintainership of Multiping for a while. I am not in a position to take on making the actual commits, but I do have an interest in cleaning and updating the module, then providing enhancements, via patches.

Have you tested out the patch in #12 above?

Jonathan

voxpelli’s picture

#12 is absolutely worth testing.

I've now decided to move forward on getting maintainership of this module so that we can see some progress.

jonathan1055’s picture

Hi Voxpelli,
Thats great news, getting maintainership.

It would be good to have at least one other person test our patch in #12 before you apply it.

Jonathan

voxpelli’s picture

Some more testing would be good - I agree.

TheInspector’s picture

The patch in #12 is working fine to me, pingomatic is pinged, which didn't work before the patch. But I still have problems to ping Twingly, I've tried both weblogUpdates.ping and weblogUpdates.extendedPing, with and without RSS. The watchdog says Failed to notify Twingly.

jonathan1055’s picture

Thanks for testing. Regarding Twingly, I think you should start a new issue, as this thread is purely for the code-improvement patch, which brings the existing code up to standards. We did not introduce any functionality changes here.

Jonathan

voxpelli’s picture

Status: Needs review » Reviewed & tested by the community

I have the feeling that this patch is ready to be committed - will do so when I find time to set up this module for the first CVS commits by me - hopefully in this or the following weekend.

voxpelli’s picture

Status: Reviewed & tested by the community » Fixed

Committed the patch from #12 - also updated the project page with a roadmap.

jonathan1055’s picture

Fantastic! this is great. We now have an active module again!
I'm busy on another drupal site at the moment, which does not have any use for multiping, but soon I will have time to get back and work on the site which does use it. I'll test it, but I'm sure everything will be exactly as we expected.

Thanks for laying out the roadmap. I'll definitely be contributing and helping you.

Jonathan.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.