From 52344cb8adc1e7dce71e9cda48b649d7db2c4bc8 Mon Sep 17 00:00:00 2001 From: ezyang Date: Thu, 9 Sep 2010 04:44:14 +0000 Subject: [PATCH] Give friendly error message if running in PHP 4. Fixes #764974 --- CHANGELOG.txt | 1 + htmlpurifier.install | 10 ++++++++++ htmlpurifier.module | 10 +++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5493146..187a75c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ - Fixed #819728; make use of Filter.ExtractStyleBlocks. Thanks Vector- for contributing the patch. - Fixed #586746; Rate limit new version checks +- Fixed #764974: Give friendly error message if running under PHP4 - Deprecated Filter.YouTube in favor of SafeObject/FlashCompat. Thanks John Morahan for contributing the patch. diff --git a/htmlpurifier.install b/htmlpurifier.install index 830f50f..530e98e 100644 --- a/htmlpurifier.install +++ b/htmlpurifier.install @@ -38,9 +38,19 @@ function htmlpurifier_uninstall() { function htmlpurifier_requirements($phase) { // This version of HTML Purifier is required static $req_version = '4.0.0'; + static $req_php_version = '5.0.0'; $requirements = array(); $t = get_t(); + if (version_compare(phpversion(), $req_php_version) < 0) { + $requirements['htmlpurifier_php'] = array ( + 'title' => $t('PHP version for HTML Purifier library'), + 'severity' => REQUIREMENT_ERROR, + 'description' => $t('PHP version is too low to run HTML Purifier. HTML Purifier requires PHP 5 or later.'), + ); + return $requirements; + } + // HACK: If libraries api module is not installed but available, load // it. This can arise when an install profile is installing multiple // modules, because the HTMLPurifier module does not publish a diff --git a/htmlpurifier.module b/htmlpurifier.module index e4cbf00..abe4102 100644 --- a/htmlpurifier.module +++ b/htmlpurifier.module @@ -1,5 +1,5 @@