Here is a patch which splits this function into whois_get_whois() and whois_display_whois(). That way, it becomes possible for other modules to use this module as a wrapper around the phpwhois library.

It also moves the watchdog function into the whois_get_whois() function so when other modules do a lookup it's logged.

Comments

deviantintegral’s picture

Status: Active » Needs review
tom friedhof’s picture

Status: Needs review » Reviewed & tested by the community

The patch installs fine with no errors and it doesn't break the module after testing it.

I like this code change because it splits a function into two smaller more focused functions so that the process of retrieving a whois object and the process of displaying the result of the whois object are now two different functions.

Good job deviantintegral.

helmo’s picture

I'm sorry to report that it did break the selected output method. Since the line fetching of whois_output_method was lost the basic method was always shown.

I've taken the liberty to address several other code style issues inspired by code-style.pl

Attached are patches both against 1.1 and against 1.1 + refactor_whois_get_whois.patch

xyber’s picture

Hey man, i rcv an error while
=====
patching patching file whois.module
Hunk #1 FAILED at 11.
Hunk #2 FAILED at 102.
Hunk #3 FAILED at 111.
Hunk #4 FAILED at 156.
Hunk #5 FAILED at 186.
Hunk #6 FAILED at 201.
6 out of 6 hunks FAILED -- saving rejects to file whois.module.rej
=====
patching file whois.module
Hunk #1 FAILED at 164.
Hunk #2 FAILED at 186.
2 out of 2 hunks FAILED -- saving rejects to file whois.module.rej
=====

Any idea why? I ran the "# patch < refactor_whois_get_whois-1.patch" and "# patch < refactor_whois_get_whois-1_incremental.patch" command. Any idea?

-Xyber.

helmo’s picture

Do you have a clean version of whois-6.x-1.1.tar.gz extracted?

Try using the -p1 option while while you are inside the whois directory,

It should look like:

$ patch < refactor_whois_get_whois-1.patch
patching file whois.module

PS: The incremental version is only usefull if you already applied refactor_whois_get_whois.patch, so you probably don't need it.

xyber’s picture

Hi,

Yes its a clean extraction. But it produces the error. If i add the p1 option it just stays there until i break operation.

-Xyber.

helmo’s picture

Unless patch isn't getting input, it should just finish or produce an error.

I asked a friend to verify that the patchfile is ok, and he could confirm this.

Have you looked at http://drupal.org/patch/apply ? It might help you track down the problem.

xyber’s picture

Status: Reviewed & tested by the community » Fixed

Did an uninstall and reinstalled again. Didn't produce the error. Thanks man!

-Xyber.

Gurpartap Singh’s picture

Status: Fixed » Needs review
helmo’s picture

Status: Needs review » Fixed

Committed

Status: Fixed » Closed (fixed)

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

deviantintegral’s picture

Glad to hear this was committed - thanks!

Little Druper’s picture

I am beginner of drupal and got this error...
patching patching file whois.module
Hunk #1 FAILED at 11.
Hunk #2 FAILED at 102.
Hunk #3 FAILED at 111.
Hunk #4 FAILED at 156.
Hunk #5 FAILED at 186.
Hunk #6 FAILED at 201.
6 out of 6 hunks FAILED -- saving rejects to file whois.module.rej

Anyway, Can I use whois module in ubercart modules? (e.g. I want to let user chose unregistered domain name and its goes in his order)
thx

helmo’s picture

As you can read in #10 this patch has already been integrated, therefore there is no need to apply this anymore.

Regarding ubercart, this question would better fit in a new issue. But to give a quick answer: you probably could with some minor glue code but I haven't tried it.

No worries everyone was new here once.

Little Druper’s picture

helmo

Thanks for your reply!

Little Druper