Commit dd188d54 authored by Dave Reid's avatar Dave Reid

by Dave Reid: Merged 6.x-2.x branch back into HEAD for a Drupal 7 branch. Must...

by Dave Reid: Merged 6.x-2.x branch back into HEAD for a Drupal 7 branch. Must get started on this now while working on 6.x-2.x.
parent 34ebcd4e
$Id$
XML Sitemap 7.x-2.x-dev
-----------------------
$Id$
XML Sitemap Module
If you are upgrading from Google Sitemap, make sure you are using the latest
version.
Installation Instructions:
1. Place the xmlsitemap directory in sites/all/modules.
2. Go to the XML Sitemap section at
http://www.example.com/?q=admin/build/modules and enable the modules for the
types of links you want in your site map. Enable XML Sitemap: Engines if you
want to be able to automatically submit your site map to search engines.
3. The sitemap is now operational at http://www.example.com/?q=sitemap.xml.
Configure advanced options at
http://www.example.com/?q=admin/settings/xmlsitemap.
$Id$
XML Sitemap Module
Author: Matthew Loar <matthew at loar dot name>
This module was originally written as part of Google Summer of Code 2005.
DESCRIPTION
-----------
The XML Sitemap module creates an XML site map at
http://www.example.com/?q=sitemap.xml that conforms to the sitemaps.org
specification. It provides many options for customizing the data reported in the
site map.
INSTALLATION
------------
See INSTALL.txt in this directory.
SPECIALIZED SITE MAPS
CONTENTS OF THIS FILE
---------------------
You can create specialized site maps using Views. To do so, enable both Views
and XML Sitemap: Node and create a new view. In the Page settings, choose XML
Sitemap: Sitemap as the view type for a regular site map or XML Sitemap: News
for a Google News site map.
* Introduction
* Installing
* Uninstalling
* Frequently Asked Questions (FAQ)
* Known Issues
* More Information
* How Can You Contribute?
INTRODUCTION
------------
Current Maintainer: Dave Reid <http://drupal.org/user/53892>
Co-maintainer: Kiam <http://drupal.org/user/55077>
Co-maintainer: Earnie <http://drupal.org/user/86710>
Co-maintainer: Darren Oh <http://drupal.org/user/30772>
Original Author: Matthew Loar <http://drupal.org/user/24879>
XML Sitemap automatically creates a sitemap that conforms to the sitemaps.org
specification. This helps search engines keep their search results up to date.
INSTALLING
----------
See http://drupal.org/getting-started/install-contrib for instructions on
how to install or update Drupal modules.
Once XML Sitemap is installed and enabled, you can adjust the settings for your
site's sitemap at admin/settings/xmlsitemap. Your can view your site's sitemap
at http://yoursite.com/sitemap.xml.
It is highly recommended that you have clean URLs enabled for this module.
UNINSTALLING
------------
Because Drupal does not uninstall modules in reverse order of their
dependencies, if you want to uninstall all the XML sitemap modules, be sure to
disable and uninstall all the sub-modules before the base XML sitemap module.
To help fix this bug in Drupal core, visit http://drupal.org/node/151452.
FREQUENTLY ASKED QUESTIONS (FAQ)
--------------------------------
- There are no frequently asked questions at this time.
KNOWN ISSUES
------------
Users who have not enabled clean URLs have reported receiving an
"Unsupported file format" error from Google. The solution is to replace
"?q=sitemap.xml" at the end of the submission URL with
"index.php?q=sitemap.xml". Submission URLs for each search engine can be
configured at http://www.example.com/?q=admin/settings/xmlsitemap/engines.
- See http://drupal.org/node/482550 for a list of the current known issues.
MORE INFORMATION
----------------
The Sitemap protocol: http://sitemaps.org.
Search engines:
http://www.google.com/webmasters/sitemap (Google)
http://developer.yahoo.com/search/siteexplorer/V1/ping.html (Yahoo!)
http://webmaster.live.com/ (Windows Live)
- To issue any bug reports, feature or support requests, see the module issue
queue at http://drupal.org/project/issues/xmlsitemap.
- For additional documentation, see the online module handbook at
http://drupal.org/handbook/modules/gsitemap.
- You can view the sitemap.org specification at http://sitemaps.org.
- You can view the module's API documentation at
http://project.davereid.net/api/xmlsitemap
HOW CAN YOU CONTRIBUTE?
-----------------------
- Report any bugs, feature requests, etc. in the issue tracker.
http://drupal.org/project/issues/xmlsitemap
- Help translate this module.
http://localize.drupal.org/translate/projects/xmlsitemap
- Write a review for this module at drupalmodules.com.
http://drupalmodules.com/module/xml-sitemap
- Help keep development active by dontating to the developer.
http://davereid.chipin.com/
<?php
// $Id$
/**
* @addtogroup hooks
* @{
*/
/**
* Define additional links to add to the site map.
*
* This hook allows modules to add additional links to the site map. Links
* may be associated with nodes, terms, or users, as shown in the example.
* @param $type:
* If set, a string specifying the type of additional links to return. You
* can use your own type or a type from one of the included modules:
* - node:
* Links associated with nodes
* - term:
* Links associated with terms
* - user:
* Links associated with users
* - xml:
* An XML site map (for including site maps from other modules)
* You can define additional types by adding them to the switch statement.
* @param $excludes:
* Depends on the type of links being requested.
* - For "node", an array of excluded node types
* - For "term", an array of excluded vocabularies
* - For "user", an array of included roles
* @return
* If $type is xml, return an XML site map. Otherwise, return an array of
* links or an empty array. Each link should be an array with the
* following keys:
* - nid, tid, uid, or custom ID type:
* ID to associate with this link (If you have defined your own link type,
* use the ID key to group related links together.)
* - #loc:
* The URL of the page
* - #lastmod:
* Timestamp of last modification
* - #changefreq:
* Number of seconds between changes
* - #priority:
* A number between 0 and 1 indicating the link's priority
*/
function hook_xmlsitemap_links($type = NULL, $excludes = array()) {
$links = array();
switch ($type) {
case 'node':
break;
case 'term':
break;
case 'user':
// Load profiles.
$result = db_query("
SELECT u.uid, xu.last_changed, xu.previously_changed, xu.priority_override, SUM(xur.priority), ua.dst AS alias
FROM {users} u
LEFT JOIN {users_roles} ur ON ur.uid = u.uid
LEFT JOIN {xmlsitemap_user_role} xur ON xur.rid = ur.rid
LEFT JOIN {xmlsitemap_user} xu ON xu.uid = u.uid
LEFT JOIN {url_alias} ua ON ua.pid = xu.pid
WHERE (xu.priority_override IS NULL OR xu.priority_override >= 0) AND u.uid <> %d
GROUP BY u.uid, xu.last_changed, xu.previously_changed, xu.priority_override, ua.dst
HAVING MIN(xur.priority) <> -1
", _xmlsitemap_user_frontpage());
// Create link array for each profile.
while ($user = db_fetch_object($result)) {
$age = time() - $user->last_changed;
$interval = empty($user->previously_changed) ? 0 : $user->last_changed - $user->previously_changed;
$links[] = array(
'uid' => $user->uid,
'#loc' => xmlsitemap_url("user/$user->uid", $user->alias, NULL, NULL, TRUE),
'#lastmod' => $user->last_changed,
'#changefreq' => max($age, $interval),
'#priority' => _xmlsitemap_user_priority($user),
);
}
// Add other user links to the links array.
$links = array_merge($links, module_invoke_all('xmlsitemap_links', 'user'));
// Sort links by user ID and URL.
foreach ($links as $key => $link) {
$uid[$key] = $link['uid'];
$loc[$key] = $link['#loc'];
}
array_multisort($uid, $loc, $links);
break;
case 'xml':
// Retrieve an XML site map.
$links = example_sitemap();
break;
default:
// Add arbitrary additional links.
$result = db_query("
SELECT xa.*, ua.dst AS alias FROM {xmlsitemap_additional} xa
LEFT JOIN {url_alias} ua ON xa.pid = ua.pid
");
while ($link = db_fetch_object($result)) {
$age = time() - $link->last_changed;
if (!empty($link->previously_changed)) {
$interval = $link->last_changed - $link->previously_changed;
}
else {
$interval = 0;
}
$entry = array(
'#loc' => xmlsitemap_url($link->path, $link->alias, NULL, NULL, TRUE),
'#lastmod' => $link->last_changed,
'#changefreq' => max($age, $interval),
'#priority' => $link->priority,
);
$additional[] = $entry;
}
break;
}
return $links;
}
/**
* Define actions for search engines.
* @param $op:
* - form:
* Add search engine to form at admin/settings/xmlsitemap.
* - ping:
* Submit site map to search engine.
* - access:
* Log search engine access.
* @param $type:
* If $op is 'access', one of the following strings will indicate what was
* downloaded:
* - Site map:
* The site map was downloaded.
* - Site map index
* The site map index was downloaded.
* - Site map $chunk
* Chunk $chunk was downloaded.
* @return
* - form:
* Array of form elements for search engine settings
* - ping:
* None
* - access:
* Message string for access log
*/
function hook_xmlsitemap_engines($op, $type = NULL) {
switch ($op) {
case 'form':
$form['google'] = array(
'#type' => 'fieldset',
'#title' => t('Google'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['google']['xmlsitemap_engines_google_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Submit site map to Google.'),
'#default_value' => variable_get('xmlsitemap_engines_google_submit', TRUE),
);
$form['google']['xmlsitemap_engines_google_url'] = array(
'#type' => 'textfield',
'#title' => t('Submission URL'),
'#default_value' => variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)),
'#description' => t('The URL to submit the site map to.'),
);
$form['google']['xmlsitemap_engines_google_verify'] = array(
'#type' => 'textfield',
'#title' => t('Verification link'),
'#default_value' => variable_get('xmlsitemap_engines_google_verify', ''),
'#description' => t('In order to show statistics, Google will ask you to verify that you control this site by creating a file with a certain name. Enter that name here and the XML Sitemap module will create a path to that file name. This will only work if you have clean URLs enabled.'),
);
return $form;
case 'ping':
if (variable_get('xmlsitemap_engines_google_submit', TRUE)) {
$result = drupal_http_request(variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)));
if ($result->code == 200) {
watchdog('xmlsitemap', 'Sitemap successfully submitted to Google.');
}
else {
watchdog('xmlsitemap', 'Error occurred submitting sitemap to Google: @code', array('@code' => $result->code), WATCHDOG_ERROR);
}
}
break;
case 'access':
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== FALSE) {
return t('!sitemap downloaded by Google.', array('!sitemap' => $type));
}
break;
}
}
/**
* @} End of "addtogroup hooks".
*/
# Danish translation of Drupal (gsitemap.module)
# Copyright 2006 Morten Wulff <wulff@tem.dtu.dk>
msgid ""
msgstr ""
"Project-Id-Version: Danish translation of Drupal (gsitemap.module) $Id$\n"
"POT-Creation-Date: 2006-04-07 15:29+0200\n"
"PO-Revision-Date: 2006-04-07 15:58+0100\n"
"Last-Translator: Morten Wulff <wulff@psyke.org>\n"
"Language-Team: Danish <dansk@dansk-gruppen.dk>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-Language: Danish\n"
"X-Poedit-Country: DENMARK\n"
#: gsitemap.module:15
msgid "Creates a Google Sitemap at q=gsitemap"
msgstr "Opretter et Google Sitemap på q=gsitemap"
#: gsitemap.module:17
msgid "The following options allow you to alter the behavior of the Google Sitemap module."
msgstr "De følgende indstillinger lader dig ændre hvordan Google Sitemap-modulet opfører sig."
#: gsitemap.module:37;402;405;443;446;0
msgid "gsitemap"
msgstr "gsitemap"
#: gsitemap.module:43
msgid "gsitemap verification page"
msgstr "Efterprøv gsitemap"
#: gsitemap.module:59
msgid "gsitemap Settings"
msgstr "Indstillinger for gsitemap"
#: gsitemap.module:65
msgid "Priority override"
msgstr "Tilsidesæt prioritet"
#: gsitemap.module:69
msgid "Optionally specify a value for the priority in the Google Sitemap, or -1 to prevent it from appearing in the sitemap."
msgstr "Angiv en værdi for prioriteten i Google Sitemap (valgfrit) eller -1 for at forhindre at indholdet optræder på sidekortet."
#: gsitemap.module:132
msgid "Priority must be a number between 0.0 and 1.0, inclusive, or -1 to prevent this node from appearing in the sitemap."
msgstr "Prioriteten skal være et tal mellem 0.0 og 1.0, inklusive, eller -1 for at forhindre at dette indhold optræder på sidekortet."
#: gsitemap.module:187
msgid "Priority Settings"
msgstr "Prioritetsindstillinger"
#: gsitemap.module:192
msgid "Front page priority"
msgstr "Forsideprioritet"
#: gsitemap.module:196
msgid "This is the absolute priority for the front page. Values can range between 0.0 and 1.0."
msgstr "Forsidens absolutte prioritet. Værdier kan være mellem 0.0 og 1.0."
#: gsitemap.module:200
msgid "Promotion adjustment"
msgstr "Juster forfremmelse"
#: gsitemap.module:204
msgid "This number will be added to the priority of each node that is promoted to the front page."
msgstr "Tallet lægges til prioriteten for hvert indholdselement, der forfremmes til forsiden."
#: gsitemap.module:208
msgid "Comment ratio weight"
msgstr "Vægt af kommentarforhold"
#: gsitemap.module:212
msgid "This number will be multiplied with the ratio of the number of comments on the node over the number of comments on the node with the most comments, i.e., this number will be added to the priority of the node with the most comments."
msgstr "Dette tal ganges med forholdet mellem antallet af kommentarer til det aktuelle indholdselement og antallet af kommentarer til indholdselementet med flest kommentarer, dvs. dette tal lægges til prioriteten af indholdselementet med flest kommentarer."
#: gsitemap.module:218
msgid "You can enter -1 in any of the following fields to prevent nodes of that type from appearing in the sitemap."
msgstr "Du kan indtaste -1 i hvert af de følgende felter for at forhindre at indhold af den angivne type optræder i sidekortet."
#: gsitemap.module:224
msgid "%name adjustment"
msgstr "%name justering"
#: gsitemap.module:228
msgid "This number will be added to the priority of nodes of type %name."
msgstr "Dette tal lægges til prioriteten af alle indholdselementer af typen %name."
#: gsitemap.module:234
msgid "Other Settings"
msgstr "Andre indstillinger"
#: gsitemap.module:240
msgid "Verification link"
msgstr "Henvisning til efterprøvning"
#: gsitemap.module:243
msgid "In order to view stats, Google will ask you to verify that you control this site by creating a page with a certain name. Enter that name here and the gsitemap module will hook that filename. Note that this will only work if you have clean URLs enabled."
msgstr "For at kunne vise statisikker vil Google bede dig om at bevise, at du kontrollerer dette netsted ved at oprette en side med et særligt navn. Indtast navnet her og gsitemap-modulet vil håndtere det. Bemærk at dette kun virker hvis du har aktiveret rene URLer."
#: gsitemap.module:247
msgid "Count comments in change date and frequency"
msgstr "Medtag kommentarer i opdateringsdato og frekvens"
#: gsitemap.module:250
msgid "If enabled, the frequency of comments on a node will affect its change frequency and last modification date."
msgstr "Frekvensen af kommentarer til et indholdslement vil påvirke dets opdateringsfrekvens og ændringsdato."
#: gsitemap.module:254
msgid "Include links to taxonomy term pages"
msgstr "Medtag henvisninger til taksonomiord"
#: gsitemap.module:257
msgid "If enabled, links to taxonomy term pages will be included in the sitemap."
msgstr "Henvisninger til taksonomiord medtages i sidekortet."
#: gsitemap.module:261
msgid "Submit sitemap to Google when updated"
msgstr "Indsend sidekort til Google ved opdatering"
#: gsitemap.module:264
msgid "If enabled, the sitemap will be submitted to Google via HTTP request each time it is updated. If you have submitted your sitemap using a Google Account, this is probably unnecessary."
msgstr "Sidekortet indsendes til Google via en HTTP-forespørgsel hver gang det opdateres. Hvis du har indsendt sidekortet vha. en Google-konto er dette sikkert unødvendigt."
#: gsitemap.module:268
msgid "Submit sitemap to Google on cron run"
msgstr "Indsend sidekort til Google når cron køres."
#: gsitemap.module:271
msgid "If enabled, the sitemap will be submitted to Google via HTTP request each time the cron job is run. If you have submitted your sitemap using a Google Account, this is probably unnecessary."
msgstr "Sidekortet indsendes til Google via en HTTP-forespørgsel næste gang der køres en cron-opgave. Hvis du har indsendt sidekortet vha. en Google-konto er dette sikkert unødvendigt."
#: gsitemap.module:275
msgid "Log accesses"
msgstr "Registrer tilgang"
#: gsitemap.module:278
msgid "If enabled, an watchdog entry will be made each time the sitemap is accessed, containing information about the requestor."
msgstr "Aktiver dette for at oprette en linje i hændelsesloggen med information om spørgeren hver gang sidekortet tilgås."
#: gsitemap.module:25
msgid "override node priority"
msgstr "tilsidesæt indholdsprioritet"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
// $Id$
/**
* @file
* Hooks provided by the XML sitemap module.
*
* @ingroup xmlsitemap
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Provide information on the type of links this module provides.
*/
function hook_xmlsitemap_link_info() {
return array(
'mymodule' => array(
'purge' => TRUE, // A boolean if this link type can be purged during a rebuild.
),
);
}
/**
* Retrieve a array of links to include in the sitemap.
*
* @return
* An array of link arrays with the following keys and values:
* - 'type' => The type of link (node, user, kitten, etc.).
* - 'id' => The ID of the link ($node->nid, $user->uid, etc.).
* - 'loc' => The un-aliased Drupal path to the item.
* - 'lastmod' => The UNIX timestmap of when the item was last modified.
* - 'changefreq' => The interval, in seconds, between the last set of changes.
* - 'priority' => An optional priority value between 0.0 and 1.0.
*/
function hook_xmlsitemap_links() {
$links = array();
$links[] = array(
'type' => 'mymodule',
'id' => 1,
'loc' => 'mymodule/menu/path',
'lastmod' => 346245692,
'changefreq' => 4600,
);
return $links;
}
/**
* Provide batch information for hook_xmlsitemap_links().
*
* It is highly recommended that if your module has a lot of items that could
* be sitemap links, that you implement this hook.
*
* All you need to do to implement this hook is add the required $context
* information.
*
* The optional current value will provide the offset parameter to
* hook_xmlsitemap_links() and should get records that are greater than this
* value. The default value is 0.
*
* The max (count) value will allow the batch to know when it is finished. This
* value is required.
*/
function hook_xmlsitemap_links_batch_info() {
return array(
'current' => 0,
// This value is used to start selecting items (WHERE id > current).
'max' => db_result(db_query("SELECT COUNT(id) FROM {mymodule}")),
// This should be the total number of items to process.
);
}
/**
* Alter the data of a sitemap link before the link is saved.
*
* @param $link
* An array with the data of the sitemap link.
*/
function hook_xmlsitemap_link_alter(&$link) {
if ($link['type'] == 'mymodule') {
$link['priority'] += 0.5;
}
}
/**
* Alter the query selecting data from {xmlsitemap} during sitemap generation.
*
* Do not alter LIMIT or OFFSET as the query will be passed through
* db_query_range() with a set limit and offset.
*
* @param $query
* An array of a query object, keyed by SQL keyword (SELECT, FROM, WHERE, etc).
* @param $args
* An array of arguments to be passed to db_query() with $query.
* @param $language
* The language object being used for sitemap generation.
*/
function hook_xmlsitemap_query_alter(array &$query, array &$args, stdClass $language) {
$query['WHERE'] .= " AND x.language = '%s'";
$args[] = $language->language;
}
/**
* @} End of "addtogroup hooks".
*/
<?php
// $Id$
/**
* @file
* Drush integration functions for the xmlsitemap module.
*
* @ingroup xmlsitemap
*/
/**
* Implements hook_drush_command().
*/
function xmlsitemap_drush_command() {
$items['xmlsitemap regenerate'] = array(
'description' => 'Regenerate the XML sitemap files.',
'callback' => 'drush_xmlsitemap_regenerate',
);
$items['xmlsitemap rebuild'] = array(
'description' => 'Dump and re-process all possible XML sitemap data, and then regenerate the files.',
'callback' => 'drush_xmlsitemap_rebuild',
);
return $items;
}
/**
* Check that the sitemap files directory exists and is writable.
*/
function drush_xmlsitemap_check_directory() {
$dir = file_create_path(xmlsitemap_var('path'));
if (!file_check_directory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
drush_die(dt('The XML sitemap cache directory @directory was not found was not writable.', array('@directory' => $dir)));
}
}
/**
* Regenerate the sitemap files from existing data.
*/
function drush_xmlsitemap_regenerate() {
drush_xmlsitemap_check_directory();
module_load_include('inc', 'xmlsitemap');
xmlsitemap_regenerate();
$vars = array(
'@timer' => timer_read('xmlsitemap_regenerate'),
'@memory-peak' => format_size(memory_get_peak_usage(TRUE)),
);
drush_print(dt('XML sitemap files regenerated in @timer ms. Peak memory usage: @memory-peak.', $vars));
}
/**
* Dump and rebuild all the sitemap data, then regenerate the files.
*/
function drush_xmlsitemap_rebuild() {
drush_xmlsitemap_check_directory();
module_load_include('inc', 'xmlsitemap');
timer_start('xmlsitemap_rebuild');
// Set the rebuild flag incase something fails during the rebuild.
variable_set('xmlsitemap_rebuild_needed', TRUE);
// Build the batch array.
$modules = module_implements('xmlsitemap_link_info');
$batch = xmlsitemap_rebuild_batch($modules, TRUE);
$batch['progressive'] = FALSE;
batch_set($batch);
// We need to manually set the progressive variable again.
// @todo Remove when http://drupal.org/node/638712 is fixed.
$batch =& batch_get();
$batch['progressive'] = FALSE;
// Run the batch process.
batch_process();
$vars = array(
'@timer' => timer_read('xmlsitemap_rebuild'),
'@memory-peak' => format_size(memory_get_peak_usage(TRUE)),
);
drush_print(dt('XML sitemap files rebuilt in @timer ms. Peak memory usage: @memory-peak.', $vars));
}
This diff is collapsed.
; $Id$
name = XML Sitemap
description = Creates an XML site map in accordance with the sitemaps.org specification.
package = XML Sitemap
core = 6.x
name = XML sitemap
description = Creates an XML sitemap conforming to the <a href="http://sitemaps.org/">sitemaps.org protocol</a>.
package = XML sitemap
core = 7.x
files[] = xmlsitemap.module
files[] = xmlsitemap.inc
files[] = xmlsitemap.admin.inc
files[] = xmlsitemap.drush.inc
files[] = xmlsitemap.pages.inc
files[] = xmlsitemap.install
files[] = xmlsitemap.test
recommends[] = ctools
recommends[] = robotstxt
recommends[] = vertical_tabs
configure = admin/config/search/xmlsitemap
This diff is collapsed.
This diff is collapsed.
<?php
// $Id$
/**
* @file
* Page callbacks for the xmlsitemap module.
*
* @ingroup xmlsitemap
*/
/**
* Output a sitemap page.
*
* @see xmlsitemap_file_transfer()
*/
function xmlsitemap_output_chunk($chunk = 0) {
global $language;
// @todo Remove this from the final version?
if (isset($_GET['refresh']) && user_access('administer xmlsitemap')) {
module_load_include('inc', 'xmlsitemap');
xmlsitemap_generate($chunk, $language);
}
$file = xmlsitemap_get_chunk_file($chunk, $language);