PopFetcher CRON

Creating and modifying plugins.
Post Reply
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

PopFetcher CRON

Post by david@mediacopy »

Hi All,

I've had a look through the old posts but can't get this to work as needed.

Essentially I need to trigger popfetcher to check for new emails once every minute.

Using the cron plugin and a cron job on a server I get get it to work every 5 minutes but this is a bit long for the application I have in mind.

I've tried to do a direct call using a CRON job set like:

* * * * * wget http://blog.myblog.co.uk/serendipity_ad ... popfetcher

and this appears to return an OK -
"HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]"

However, the cron does not seem to actually trigger popfetcher to collect mail.

(I've removed the cron job plug in and set popfetcher Plugin Type to 'External')


Any suggestions ?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PopFetcher CRON

Post by garvinhicking »

Hi!

No, this is the wrong URL. Check the configuration of the popfetcher plugin, it should offer you the URL to use in a screenshot there. Also, if you use the s9y cronjob plugin, you might want to uninstall that because it removes exactly that manual cronjob option.

The cronjob plugin URL would be something like http://yourblog/index.php?/plugin/popfetcher_YOURNAME -- you actually configure the proper URL in the configuration.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

Re: PopFetcher CRON

Post by david@mediacopy »

Thanks Gavin,
Check the configuration of the popfetcher plugin, it should offer you the URL to use in a screenshot there
erm, not seeing that. I get all the config options - the first being 'Plugin type' but no hint (that I've spotted') of the correct URL for a CRON set ip.

In the online documentation it gives the url as:

Code: Select all

http://{yourblog}/index.php?/plugin/popfetcher_poll
but that differers to your suggestion below:

Code: Select all

http://yourblog/index.php?/plugin/popfetcher_YOURNAME
unless 'poll' is the name ? Would that be the login name??
you actually configure the proper URL in the configuration.
doh !!! - that would be the "External Launch Name" config setting :oops:

That's starting to make more sense. I'll give it a go...
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

Re: PopFetcher CRON

Post by david@mediacopy »

Still no luck.

I used the format as suggested, ie:

wget http://blog.xxxxxxxx.co.uk/index.php?/p ... etcher_sms

where 'sms' is set in the "External Launch Name " setting and "Plugin Type " is set to external in the popfetcher configuration.

The cron reports a 200 code and no errors.

If I use the URL http://blog.xxxxxxxx.co.uk/index.php?/p ... etcher_sms in a browser tab, nothing is returned.

If I set 'Plugin Type" back to 'internal' and manually check main mail is collected as expected.

Is there anything I can check to try and ID the issue? Presumably the fact that I've installed to a sub-domain will not be an issue ?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PopFetcher CRON

Post by garvinhicking »

Hi!

Basically you are right, the backend name is the one you need to call in the cronjob.

It's strange that you get no results when calling it. Try to set it to "external" again, call the cronjob URL you posted earlier, and see if it still does not output anything if in the serendipity_event_popfetcher.php you change this code:

Code: Select all

                case 'external_plugin':
                    if ($adminmenu) return false;
                    $hidename = $this->get_config('hidename');
                    $events = explode('_', $eventData);
                    if ($events[0] != trim($hidename)) return false;

to this:

Code: Select all

                case 'external_plugin':
echo "EXTERNA PLUGIN!";
                    if ($adminmenu) return false;
                    $hidename = $this->get_config('hidename');
                    $events = explode('_', $eventData);
echo "CHECK IF WE ARE CALLED: " . $eventData . " == " . $hidename . "<br />\n";
                    if ($events[0] != trim($hidename)) return false;
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

Re: PopFetcher CRON

Post by david@mediacopy »

Cheers Gavin.

So I double checked it, restarted the Cron job, set the config to 'external' - no change - No email was collected.

I amended the code as you suggested and dropped the URL into a browser tab:

The return was:

Code: Select all

EXTERNA PLUGIN!CHECK IF WE ARE CALLED: popfetcher_sms == sms
which seems to indicate that it's being called OK ? (I tried setting the launch name in the config to popfetcher_sms but no joy).

To double check I reset the config setting to 'Internal' and only EXTERNA PLUGIN! was returned in the browser. Which I clicked the popfetcher link in the menu mail is collected as expected.

Cheers

David
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PopFetcher CRON

Post by garvinhicking »

Hi!

Ah :) You shall not pass a "_" in the external name, since that is used as an option concatenator. "use only "sms" or "popfetcher-sms"!

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

Re: PopFetcher CRON

Post by david@mediacopy »

garvinhicking wrote:Ah :) You shall not pass a "_" in the external name, since that is used as an option concatenator. "use only "sms" or "popfetcher-sms"!
In the example I tried the external name was set to only "sms" and gave the results above. I did also try setting it to "popfetcher_sms" but this failed too (as expected with the _ ) I'll try again with "popfetcher-sms" and I may try deleting and reinstalling popfetcher.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PopFetcher CRON

Post by garvinhicking »

Hi!

Did you try each of those options:

- external name "sms", URL called: index.php?/plugin/sms
- external name "sms", URL called: index.php?/plugin/popfetcher_sms
- external name "popfetcher_sms", URL called: index.php?/plugin/sms
- external name "popfetcher_sms", URL called: index.php?/plugin/popfetcher_sms

One (I believe the second) should work...

HTH,
GArvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

Re: PopFetcher CRON

Post by david@mediacopy »

The 2nd one is the one I tried, but I'll double check and try the others too.

Thanks for your help :-)
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

Re: PopFetcher CRON

Post by david@mediacopy »

OK - So I tried it again.

I un-installed then reinstalled pop-fetcher.

Plugin type set to "External"
External Launch Name set to "popfetcher-sms"
Cron call set to "wget http://blog.trackday-listings.co.uk/ind ... etcher-sms"

When the cron URL is pasted directly to the browser it returns:

EXTERNA PLUGIN!CHECK IF WE ARE CALLED: popfetcher_popfetcher-sms == popfetcher-sms

No email is collected.

When Plugin type is set to "Internal" and clicked from the menu, mail is collected as expected.

Presumably this is not a CRON problem as such as the 'direct' URL is not functioning ?

Is there another way of calling the URL directly ?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PopFetcher CRON

Post by garvinhicking »

Hi!

What about the other 3 configuration possibilities? I wrote, what output do they yield?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

Re: PopFetcher CRON

Post by david@mediacopy »

Cheers Gavin,

Code: Select all

- external name "sms", URL called: index.php?/plugin/sms
This one works perfectly !

Thanks very much for your help
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PopFetcher CRON

Post by garvinhicking »

Hi!

Phew. I knew some of those should work, sorry it took us so long :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
david@mediacopy
Regular
Posts: 56
Joined: Sun May 18, 2008 5:50 pm

Re: PopFetcher CRON

Post by david@mediacopy »

No problem, I'd assumed that the syntax 'looked' wrong hence not trying it. Thanks again :-)
Post Reply