Background tasks in PHP: pinging weblogs.com

A long time ago, Ivan looked at executing background tasks in PHP after the actual request by the browser was over. He explained that it disappeared in PHP 4.1, but should be (and is) part of PHP 4.3.1.
I modified b2edit.php to use the register_shutdown_function to call the pingWeblogs, and pingBlogs functions:
From (line 100 of b2edit.php):

rss_update($blog_ID);
pingWeblogs($blog_ID);
pingCafelog($cafelogID, $post_title, $post_ID);
pingBlogs($blog_ID);

to

//rss_update($blog_ID);
pingCafelog($cafelogID, $post_title, $post_ID);
register_shutdown_function( "pingWeblogs" );
register_shutdown_function( "pingBlogs" );

This probably won’t work if you’re using PHP 4.1, so test it after you make the change! Does it make posting to b2 faster? I’m not sure. I don’t think those functions “disconnect” from the browser completely. Of course, I could be mistaken and the delay could be in another part of the code! I don’t honestly know.
Final note – I made a quick optimization by removing the call to rss_update(). That function creates the b2rss.xml file. Since we don’t use that file (use b2rss2.php or b2rdf.php instead!), the function call isn’t required!

Miaow!

This is a demo of the customfield used to create a “photoblog” of sorts. In my “Picture” field I have the names of my 3 images, seperated by “;;;”. A Smarty foreach loop then runs through the list of images. You can find more information in your “Custom Fields” administration page.

New b2++ release – 0.6.1

You can now download the new 0.6.1 release of b2++. I had to add a small fix this morning as I had forgotten that a few database tables had to be created.. Somehow the referer feeder script got left out too. One the disadvantages of doing “diff --brief -r . htdocs | grep -v Only” and releasing code late at night..

Anyway, this one is worth downloading:

1. Fixed random template selection when new blog created.
2. Added Template help template. (Thanks Jim!)
3. Docs to configure Apache were wrong in install.php
4. I’ll try and detect if mod_rewrite is off in the actual install, not after.
5. Added blo.gs “favourites” plugin.
6. Moved lots of backend text into templates.
7. Templatised archives code.
8. Comments popup redirects to a “fresh” url.
9. Added lastupdated templates to default themes.
10. Redirect doesn’t go to index.php now.
11. Added referer plugin.
12. Added option to display comments on weblog.
13. Added b2customfields plugin.
14. Enabled Smiley support.