Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4636
sitemap.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:02 PM
2014-11-21 22:02:44 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
sitemap.patch
View Options
Index: maintenance/generateSitemap.php
===================================================================
--- maintenance/generateSitemap.php (revision 30843)
+++ maintenance/generateSitemap.php (working copy)
@@ -162,6 +162,16 @@
* Generate a one-dimensional array of existing namespaces
*/
function generateNamespaces() {
+ /*
+ Use a subset of namespaces if it's defined
+ */
+ global $wgSiteMapNamespaces, $wgSiteMapExcludeNamespaces;
+ if (is_array($wgSiteMapNamespaces))
+ {
+ $this->namespaces = $wgSiteMapNamespaces;
+ return;
+ }
+
$fname = 'GenerateSitemap::generateNamespaces';
$res = $this->dbr->select( 'page',
@@ -175,7 +185,14 @@
);
while ( $row = $this->dbr->fetchObject( $res ) )
+ {
+ if (is_array($wgSiteMapExcludeNamespaces)
+ && array_key_exists($row->page_namespace, $wgSiteMapExcludeNamespaces))
+ {
+ continue;
+ }
$this->namespaces[] = $row->page_namespace;
+ }
}
/**
@@ -367,9 +384,10 @@
* @return string
*/
function indexEntry( $filename ) {
+ global $wgServer;
return
"\t<sitemap>\n" .
- "\t\t<loc>$filename</loc>\n" .
+ "\t\t<loc>" . $wgServer . "/$filename</loc>\n" .
"\t\t<lastmod>{$this->timestamp}</lastmod>\n" .
"\t</sitemap>\n";
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4201
Default Alt Text
sitemap.patch (1 KB)
Attached To
Mode
T14860: Limiting sitemap items by namespace
Attached
Detach File
Event Timeline
Log In to Comment