Staticize Reloaded

The caching plugin I pointed to the other day was very well-executed but it didn’t meet my needs for several reasons, mainly that it cached every bit of output, which wouldn’t be appropiate for things like my random photo. (Or my non-rotating photo formerly known as the random photo in the header. It’s on break right now.) My site is a pretty neat system of PHP includes, and I want to preserve that because it makes my life easy and doesn’t slow anything down any perceptable amount.

So I took the Staticize plugin and added support for dynamic non-cached sections, cleaned up the code a bit, fixed a weird problem where it would just show a blank page if it couldn’t write the file, fixed the problem with edit links and the comment form, and made it fit with the WordPress code a little smoother. Full instructions are included with the plugin, but to install just make sure your wp-content folder is writable (you may have already done that when setting up WP) and activate the plugin, and it will start working immediately.

I have a couple more improvements in mind for it already, but it’s fully functional and I’m running it right now.

Download Staticize Reloaded 2.0.

38 thoughts on “Staticize Reloaded

  1. Cool. I personally prefer plugins to includes, so I added a line to your code to allow me to exclude a function from the case as well as a include:

    $store = preg_replace('|<!--fclude (.*?)-->(.*?)<!--/fclude-->|s', '<?php $1 ;?>', $buffer);

    Then in my template I use the syntax:

    <!--fclude heldomatic() -->
    <?php heldomatic(); ?>
    <!--/fclude-->

    Seems to work.

  2. Well I suppose it could be easily modified to allow any PHP code, but because it’s included from inside a function every variable that was used would have to be explicitly global.

  3. Pingback: ryanschwartz.net
  4. As far as I can tell, all the trackback rdf info shows up as invalid for some reason when I use the plugin (and the original version of the plugin). I deactivate the plugin and all is well. I’m assuming there’s some snippet of code in the head somewhere that isn’t being cached/served and the rdf stuff depends on it somehow.

  5. This is probably a php/fopen thang, but I noticed that if a parent directory is not world readable (even if +x), the script fails and says that it can’t create the temp files (although it creates the wp_content/cache dir just fine).

    I am far from a php guru, but thought i’d mention that I had to chmod o+r all the way down my dir tree in order for this plugin to work (all previous plugins seemed to work okay before *shrug*).

  6. Hrm. I’m running into a problem with the required include file (for blogrolls) being cached as well. The output isn’t updated unless a new comment or entry is added in WP and it should be dynamic.

    In my index.php file I have a require in there pointing to my blogroll:

    blogroll.php contents are simply:

    Any ideas if I missed something or am doing something wrong? If I shut off the caching plugin, it updates properly.

    Thanks!

  7. Hrm. Code seems to have been stripped out of the above comment when surrounded by code tags. I’ll try again:

    index.php:
    <?php require ‘includes/blogroll.php’; ?>

    blogroll.php:
    <?php wp_get_links(1); ?>

  8. This is excellent, I must say. The benefits of static pages without the pain of republishing.

    One issue however: it doesn’t appear to rebuild pages when a trackback comes in. I’ve tried this on a couple of WP installations, and it seems to be consistent in this.

  9. I have a problem when using Staticize Reloaded plugin provided with the 2004.08.30 nightly build of WordPress. WordPress is installed into a different directory using this method: different address.

    The “different address” hack works without the plugin activated. When activated, I have this error message:

    Warning: main(/home/seanlong/www/wp//wp/wp-header.php): failed to open stream: No such file or directory in /home/seanlong/www/index.php on line 4

    Warning: main(): Failed opening ‘/home/seanlong/www/wp//wp/wp-header.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/seanlong/www/index.php on line 4

    Any ideas?

  10. After installing it, everything seems cool, although my RSS feed doesn’t appear to refresh. Is there a workaround? I’ve checked in two different readers (Firefox live bookmars, and RSS Bandit). Since I activated the plugin neither has received anything new.

  11. I found an important concurrency bug: if more than a client access to the same page, the same content could be appended several times to the same cache file.

    It’s repeatable by using Apache Benchmark (ab).

  12. This plugin has successfully turned my WP pages into gibberish 50% of the time. In Opera and Firefox both. Sometimes refreshing it fixes it, and sometimes it doesn’t.

    Anyone else have this problem?

  13. Pingback: Qbic
  14. No thanks, i think i’ll stay away from something that can wreak havoc and bust your set up just to save a few miliseconds of time that you can do easily by just trimming the fat off the site. Laziness can make more trouble than using a little effort.

    Still, hope you guys finally work it out.

SHARE YOUR THOUGHTS