August 27, 2007

random facts V

Filed under: ZenMagick — DerManoMann @ 11:39 am

Configuring page caching with a custom function

This is good for plugins or more complex code. Per default, the function zm_is_page_cacheable() decides whether a page can be cached or not. The name of this function is set up in the setting pageCacheStrategyCallback.

So, setting the value of that setting to your function name will make the cache controller call your function instead of the default.

The wiki plugin is an example for the second approach.

Custom error logging

Since 0.8.1 there is are two new options to control all PHP and ZenMagick logging.

The first is the setting ‘zmLogFilename‘. If the value is not null (null is the default), then all ZenMagick logging is written into that file. Make sure that the file is writeable and there is enough disk space!

The second, even more powerful setting, is ‘isZMErrorHandler‘, This is a boolean flag. The default is false, but when set to true, a custom PHP error handler will be used to log all PHP messages.

Note that the error handler depends on a custom log filename, so just enabling the error handler will not work.

There is, however, still a small bug in ZenMagick that will make ZenMagick log messages not appear in the logfile! This is fixed in subversion and will be in the next release.

An example of how this can be used in local.php would be the following:


zm_set_setting('zmLogFilename', $zm_runtime->getZMRootPath()."zenmagick.log");
zm_set_setting('isZMErrorHandler', true);

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.