Commit f731b47d authored by Dave Reid's avatar Dave Reid

Issue #1158956: Added requirements check for the xmlwriter PHP extension.

parent e4c0cfbd
......@@ -14,18 +14,34 @@ function xmlsitemap_requirements($phase) {
$requirements = array();
$t = get_t();
// If clean URLs are disabled there must not be an actual sitemap.xml in
// the root directory.
if (variable_get('clean_url', 0) && file_exists(DRUPAL_ROOT . '/sitemap.xml')) {
$requirements['xmlsitemap_file'] = array(
'title' => $t('XML sitemap'),
'value' => $t('Existing sitemap.xml file found.'),
// Check that required PHP extensions are enabled.
// Note: Drupal 7 already requires the 'xml' extension.
$required_extensions = array('xmlwriter');
$missing_extensions = array_diff($required_extensions, array_filter($required_extensions, 'extension_loaded'));
if (!empty($missing_extensions)) {
$requirements['xmlsitemap_php_extensions'] = array(
'title' => $t('XML sitemap PHP extensions'),
'value' => $t('Disabled'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('The XML sitemap module cannot display its XML output if there is an existing sitemap.xml file in your website root.'),
'description' => $t("The XML sitemap module requires you to enable the PHP extensions in the following list (see the <a href=\"@xmlsitemap_requirements\">module's system requirements page</a> for more information):", array(
'@xmlsitemap_requirements' => 'http://drupal.org/documentation/modules/xmlsitemap/requirements',
)) . theme('item_list', array('items' => $missing_extensions)),
);
}
if ($phase == 'runtime') {
// If clean URLs are disabled there must not be an actual sitemap.xml in
// the root directory.
if (variable_get('clean_url', 0) && file_exists(DRUPAL_ROOT . '/sitemap.xml')) {
$requirements['xmlsitemap_file'] = array(
'title' => $t('XML sitemap'),
'value' => $t('Existing sitemap.xml file found.'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('The XML sitemap module cannot display its XML output if there is an existing sitemap.xml file in your website root.'),
);
}
// Check that the base directory and all its subdirectories are writable.
$requirements['xmlsitemap_directory'] = array(
'title' => $t('XML sitemap cache directory'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment