function xmlsitemap_update_6203 in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap.install \xmlsitemap_update_6203()
Convert the xmlsitemap_max_filesize variable to a max_filesize column per-sitemap.
File
- ./
xmlsitemap.install, line 645 - Install, update and uninstall functions for the xmlsitemap module.
Code
function xmlsitemap_update_6203() {
$ret = array();
if (db_column_exists('xmlsitemap_sitemap', 'max_filesize')) {
return $ret;
}
// Add the max_filesize column.
$field = array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
);
db_add_field($ret, 'xmlsitemap_sitemap', 'max_filesize', $field);
// Scan each sitemap directory for the largest file.
drupal_load('module', 'xmlsitemap');
$sitemaps = xmlsitemap_sitemap_load_multiple(FALSE);
foreach ($sitemaps as $sitemap) {
xmlsitemap_sitemap_get_max_filesize($sitemap);
db_query("UPDATE {xmlsitemap_sitemap} SET max_filesize = %d WHERE smid = %d", $sitemap->max_filesize, $sitemap->smid);
}
variable_del('xmlsitemap_max_filesize');
variable_del('xmlsitemap_max_chunks');
return $ret;
}