Piwik Notes #1 :: Cascading Include References

In ‘index.php’ (line 35) a ‘testMinimumPhpVersion.php’ is required. If you comment this line out, taking it for what it seems, Piwik dies with a Fatal Error, since the file includes another file, which defines necessary functions etc.

This is an example for using Cascading Include References. Do not take this as a role model for software development, it makes your code confusing, since you do not expect an all-purpose loader defined in a file ‘upgrade.php’ included in a file ‘testMinimumPhpVersion.php’ required in your ‘index.php’. Dig it?

Btw, PHP version and Zend PHP4 compatibility mode indeed are checked in the ‘testMinimumPhpVersion.php’, and, if inappropriate, a warning message is defined, but not displayed at first. Why not? A function showing error messages in an indeed! ‘friendly UI’ is defined. Then, if a warning message is set, this function is called with the warning message.

Don’t do this, unless you intend to rename your error message display function every now and then. Keep your processes in logical blocks, the refactoring guy will be grateful.

The mentioned error message display function is referenced in five different files.

The checks for PHP version and Zend PHP4 compatibility mode can be commented out once your Piwik instance is running, due to scalability reasons, such tests belong to a prerequisite check upon the installation process.

Piwik is a high end Open Source Web Analytics Tool.