Cronjob functionality

Two new plugins have been added to CVS by me:

serendipity_event_metadesc / "HTML META-Tags" allows you to define meta-description and meta-keywords per entry. Those will then be shown on the detailed entry page within the HTML head. As a nice bonus, if you leave the fields empty, the plugin tries to auto-detect keywords and description based on your text. For that it evaluates Bold/Strong tags in HTML to auto-guess your content.

serendipity_event_cronjob / "Cronjob scheduler" finally offers some cronjob functionality that people have sometimes requested. A lengthy explaination of this plugin follows. :-)

For anyone that does not know what "Cronjobs" are: This is a service, one of the UNIX/LINUX server oldies, that permanently runs on a webserver and executes scheduled scripts at a given time/period. With this you can setup repetitive tasks, like to purge all your SPAM E-Mails every day.

Now, such cronjobs usually require you to have administrative privileges on the server where it is operated on. The Cron Daemon needs to run all the time, because only then it can execute a job at the exact configured time. Now a common use some people want is: "Fetch my E-Mail account every day to see if there are mails that shall get blogged!".

If you only own a usual PHP webspace, this will get problematic. You cannot create cronjobs there, and since PHP only gets activated when someone visits your blog, you can't really say "Execute this script at 00:00", because you don't know if your script is called at that time. This is the reason, why "cronjobs" are usually not encouraged to use on a PHP-basis.

The best way it can be emulated is like this: Every page call to your serendipity Blog can contain an invisible image that your visitors call again and again, and each time the script is called, it calculates the difference between the last script call and will then check which cronjobs need to be executed.

If your blog is low on visitors, this means that maybe a cronjob that is scheduled every 5 minutes would only get executed once an hour. There's nothing you can really do about that, unless you own a server were you can create a remote cronjob that calls WGET or similars on your URL, to fake regular visits to your blog.

Now that the principle bheind this is clear, here's what the cronjob plugin does: It emits exactly the invisible picture, and servers up multiple plugin API hooks that other plugins can use. Currently, only the popfetcher (1.13) and aggregator (0.7) plugins support cronjobs. Once you have the cronjob plugin installed you can configure these plugins inseid their own configuration to be executed on the available cronjobs.

Feedback about this functionality is appreciated. Be warned that this script of course creates extra requests to your blog. So if there's any way for you to setup "real" cronjobs, you are advised to do so.

Trackbacks

Trackback-URL für diesen Eintrag

Kommentare

Ansicht der Kommentare: (Linear | Verschachtelt)

CoSTa am um :

hello garv!

i have some warnings when using html-meta tags plugin. basically it works (there are meta fields in extended entry head section) but i also fet mentioned warnings:

Warning: arraykeys() [function.array-keys]: The first argument should be an array in /home/costa/publichtml/plugins/ serendipityeventmetadesc/serendipityeventmetadesc.php on line 162

Warning: implode() [function.implode]: Bad arguments. in /home/costa/publichtml/plugins/ serendipityeventmetadesc/serendipityevent_metadesc.php on line 162

Anonym am um :

Webcron is an alternative:

http://www.webcron.org/

It HTTP-GETs a file from your server on the specified time.

Nils+Hitze am um :

Damn, i wanted to say that. Im using this service for over 3 Years now, and im very happy. Support them by linking to them and you get bonuspoints for additional Cronjobs + automatic logfiledeleting. Although it only has a timeout of 30 Seconds right now, with the right scriptconfiguration it is unbeaten. Unless you own a server :)

Mark Taff am um :

OT: I need to replace wordpress. I need a blog that will return all output in a PHP variable, and not echo anything to the http stream, so I can include the blog portions anywhere within the body of a document.

Can s. do this? I had to ask here, as the forum won't let me in. Thanks.

Mark

rom am um :

Mark, imho there is no plugin for s9y to save all output in a PHP variable, but maybe Im wrong with this statement. ;)

Anyway, there is an Option in the Admins Configuration Menu, which enables "embedded using" of s9y. The description says:

"If you want to embed serendipity within a regular page, set to true to discard any headers and just print the contents. You can make use of the indexFile option to use a wrapper class where you put your normal webpage headers. See the README file for more information!"

Maybe this can help you.

Garvin am um :

Mark: Like rom mentioned, the embed functionality bundled with ob_start() can pipe all the output to a single PHP variable :)

Mark Taff am um :

Thanks. An output buffer is exactly what I was after.

I think I may finally be permitted to login to the forum, which is good, as I found a bug.

Andi Berg am um :

Although I don't really need the plugin (as I have my own server) the hidden image trick gave me new ideaas on some features I have to implement. So thanks for the inspiration...

Kommentar schreiben

Die angegebene E-Mail-Adresse wird nicht dargestellt, sondern nur für eventuelle Benachrichtigungen verwendet.

Um maschinelle und automatische Übertragung von Spamkommentaren zu verhindern, bitte die Zeichenfolge im dargestellten Bild in der Eingabemaske eintragen. Nur wenn die Zeichenfolge richtig eingegeben wurde, kann der Kommentar angenommen werden. Bitte beachten Sie, dass Ihr Browser Cookies unterstützen muss, um dieses Verfahren anzuwenden.
CAPTCHA

BBCode-Formatierung erlaubt
Markdown-Formatierung erlaubt