Index: trunk/phase3/maintenance/generateSitemap.php |
— | — | @@ -122,14 +122,23 @@ |
123 | 123 | var $file; |
124 | 124 | |
125 | 125 | /** |
| 126 | + * Identifier to use in filenames, default $wgDBname |
| 127 | + * |
| 128 | + * @var string |
| 129 | + */ |
| 130 | + private $identifier; |
| 131 | + |
| 132 | + /** |
126 | 133 | * Constructor |
127 | 134 | */ |
128 | 135 | public function __construct() { |
129 | 136 | parent::__construct(); |
| 137 | + global $wgDBname; |
130 | 138 | $this->mDescription = "Creates a sitemap for the site"; |
131 | 139 | $this->addOption( 'fspath', 'The file system path to save to, e.g. /tmp/sitemap; defaults to current directory', false, true ); |
132 | 140 | $this->addOption( 'urlpath', 'The URL path corresponding to --fspath, prepended to filenames in the index; defaults to an empty string', false, true ); |
133 | 141 | $this->addOption( 'compress', 'Compress the sitemap files, can take value yes|no, default yes', false, true ); |
| 142 | + $this->addOption( 'identifier', 'What site identifier to use for the wiki, defaults to $wgDBname', false, true ); |
134 | 143 | } |
135 | 144 | |
136 | 145 | /** |
— | — | @@ -144,11 +153,12 @@ |
145 | 154 | if ( $this->urlpath !== "" && substr( $this->urlpath, -1 ) !== '/' ) { |
146 | 155 | $this->urlpath .= '/'; |
147 | 156 | } |
| 157 | + $this->identifier = $this->getOption( 'identifier', wfWikiID() ); |
148 | 158 | $this->compress = $this->getOption( 'compress', 'yes' ) !== 'no'; |
149 | 159 | $this->dbr = wfGetDB( DB_SLAVE ); |
150 | 160 | $this->generateNamespaces(); |
151 | 161 | $this->timestamp = wfTimestamp( TS_ISO_8601, wfTimestampNow() ); |
152 | | - $this->findex = fopen( "{$this->fspath}sitemap-index-" . wfWikiID() . ".xml", 'wb' ); |
| 162 | + $this->findex = fopen( "{$this->fspath}sitemap-index-{$this->identifier}.xml", 'wb' ); |
153 | 163 | $this->main(); |
154 | 164 | } |
155 | 165 | |
— | — | @@ -350,7 +360,7 @@ |
351 | 361 | */ |
352 | 362 | function sitemapFilename( $namespace, $count ) { |
353 | 363 | $ext = $this->compress ? '.gz' : ''; |
354 | | - return "sitemap-" . wfWikiID() . "-NS_$namespace-$count.xml$ext"; |
| 364 | + return "sitemap-{$this->identifier}-NS_$namespace-$count.xml$ext"; |
355 | 365 | } |
356 | 366 | |
357 | 367 | /** |