From: Robert Leverington Date: Thu, 17 Apr 2008 18:02:05 +0000 (+0000) Subject: Slightly modified version of attachment 4606 by Sergey Chernyshev, fixes bug 12860... X-Git-Tag: 1.31.0-rc.0~48234 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=fa13680e009ae12962cbdd033695126422b49f2d;p=lhc%2Fweb%2Fwiklou.git Slightly modified version of attachment 4606 by Sergey Chernyshev, fixes bug 12860 and adds a new configuration variable $wgSitemapNamespaces to allow specification of which namespaces a sitemap will be generated for. Defaults to false, indicating all namespaces should have a sitemap generated for them. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 7b7d49dd39..da74aee564 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3038,3 +3038,10 @@ $wgMaxRedirectLinksRetrieved = 500; * such as PAGESINCATEGORY. */ $wgExpensiveParserFunctionLimit = 100; + +/** + * Array of namespaces to generate a sitemap for when the + * maintenance/generateSitemap.php script is run, or false + * if one is to be generated for all namespaces. + */ +$wgSitemapNamespaces = false; \ No newline at end of file diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index c0f1189d05..fcb9adab8d 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -164,6 +164,13 @@ class GenerateSitemap { function generateNamespaces() { $fname = 'GenerateSitemap::generateNamespaces'; + // Only generate for specific namespaces if $wgSitemapNamespaces is an array. + global $wgSitemapNamespaces; + if( is_array( $wgSitemapNamespaces ) ) { + $this->namespaces = $wgSitemapNamespaces; + return; + } + $res = $this->dbr->select( 'page', array( 'page_namespace' ), array(),