? htmlpurifier-783066.patch ? requirementsv3.patch ? update-htmlpurifier-4.1.0.sh Index: htmlpurifier.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/htmlpurifier/htmlpurifier.install,v retrieving revision 1.9 diff -u -p -r1.9 htmlpurifier.install --- htmlpurifier.install 22 Oct 2009 15:40:01 -0000 1.9 +++ htmlpurifier.install 28 Apr 2010 19:56:24 -0000 @@ -38,6 +38,7 @@ function htmlpurifier_requirements($phas // This version of HTML Purifier is required static $req_version = '4.0.0'; $requirements = array(); + $t = get_t(); // Can't use drupal_get_path, since module may not have been installed. $module_path = dirname(__FILE__); @@ -45,7 +46,7 @@ function htmlpurifier_requirements($phas if (!file_exists("$module_path/library/HTMLPurifier.auto.php")) { $requirements['htmlpurifier'] = array ( 'severity' => REQUIREMENT_ERROR, - 'description' => t("Could not find HTML Purifier + 'description' => $t("Could not find HTML Purifier installation in @path. Please copy contents of the library folder in the HTML Purifier tarball or zip to this folder or ensure HTMLPurifier.auto.php exists. @@ -57,10 +58,9 @@ function htmlpurifier_requirements($phas else { require_once "$module_path/library/HTMLPurifier.auto.php"; if (!defined('HTMLPurifier::VERSION') || version_compare($old = HTMLPurifier::VERSION, $req_version, '<')) { - $requirements['htmlpurifier'] = array ( 'severity' => REQUIREMENT_ERROR, - 'description' => t("HTML Purifier @old is not compatible + 'description' => $t("HTML Purifier @old is not compatible with this module: HTML Purifier @required or later is required. If the required version is a dev version, you will need to check @@ -71,7 +71,41 @@ function htmlpurifier_requirements($phas ); } } - + + if ($phase=='runtime') { + $current = variable_get('htmlpurifier_version_current', FALSE); + if (!$current) { + htmlpurifier_cron(); + $current = variable_get('htmlpurifier_version_current', FALSE); + } + $ours = variable_get('htmlpurifier_version_ours', FALSE); + if (!$ours || version_compare($current, $ours, '>')) { + // Update our version number if it can't be found, or there's a mismatch. + _htmlpurifier_load(); + $ours = variable_get('htmlpurifier_version_ours', FALSE); + } + if ($current && $ours && version_compare($current, $ours, '>')) { + $requirements['htmlpurifier_library'] = array( + 'title' => $t('HTML Purifier Library'), + 'value' => $t('Out of date'), + 'description' => $t('Your HTML Purifier library is out of date. The most + recent version is %version, which you can download from + htmlpurifier.org. To update, replace + %path/library/ with the library/ directory from + the downloaded archive.', + array('%version' => $current, '%path' => drupal_get_path('module', 'htmlpurifier'))), + 'severity' => REQUIREMENT_WARNING, + ); + } + if (count($requirements) == 0) { + $requirements['htmlpurifier'] = array( + 'severity' => REQUIREMENT_OK, + 'title' => $t('HTML Purifier Library'), + 'value' => $ours, + ); + } + } + return $requirements; } Index: htmlpurifier.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/htmlpurifier/htmlpurifier.module,v retrieving revision 1.12 diff -u -p -r1.12 htmlpurifier.module --- htmlpurifier.module 13 Dec 2009 01:10:18 -0000 1.12 +++ htmlpurifier.module 28 Apr 2010 19:56:24 -0000 @@ -35,35 +35,6 @@ function htmlpurifier_cron() { variable_set('htmlpurifier_version_current', $version); } -/** - * Implementation of hook_init(). - * @note - * Displays any need to update the HTML Purifier library. - */ -function htmlpurifier_init() { - if (user_access('access administration pages')) { - $current = variable_get('htmlpurifier_version_current', FALSE); - if (!$current) { - htmlpurifier_cron(); - $current = variable_get('htmlpurifier_version_current', FALSE); - } - $ours = variable_get('htmlpurifier_version_ours', FALSE); - if (!$ours || version_compare($current, $ours, '>')) { - // Update our version number if it can't be found, or there's a mismatch. - _htmlpurifier_load(); - $ours = variable_get('htmlpurifier_version_ours', FALSE); - } - if ($current && $ours && version_compare($current, $ours, '>')) { - drupal_set_message( - t('Your version of HTML Purifier is currently out of date; '. - 'the most recent version is %version. You can download the latest '. - 'version at htmlpurifier.org. '. - 'To update, place the contents of HTML Purifier\'s library/ folder in '. - 'modules/htmlpurifier/library/.', - array('%version' => $current)), 'warning', FALSE); - } - } -} /** * Implementation of hook_filter().