X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FgenerateSitemap.php;h=dc1de4f48078ebcd185a446accee20b04592d000;hb=8cea6e052c944bec3abe241463d6b86f9a706a3a;hp=b3e7aecf2f3f6f5a2e7a5d6708e366643d6239b8;hpb=1b4f3579017a46344a9f1857db241bc3909bb7f5;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index b3e7aecf2f..dc1de4f480 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -26,6 +26,8 @@ * @see http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -316,7 +318,7 @@ class GenerateSitemap extends Maintenance { * Main loop */ public function main() { - global $wgContLang; + $contLang = MediaWikiServices::getInstance()->getContentLanguage(); fwrite( $this->findex, $this->openIndex() ); @@ -327,7 +329,7 @@ class GenerateSitemap extends Maintenance { $length = $this->limit[0]; $i = $smcount = 0; - $fns = $wgContLang->getFormattedNsText( $namespace ); + $fns = $contLang->getFormattedNsText( $namespace ); $this->output( "$namespace ($fns)\n" ); $skippedRedirects = 0; // Number of redirects skipped for that namespace foreach ( $res as $row ) { @@ -358,10 +360,10 @@ class GenerateSitemap extends Maintenance { $length += strlen( $entry ); $this->write( $this->file, $entry ); // generate pages for language variants - if ( $wgContLang->hasVariants() ) { - $variants = $wgContLang->getVariants(); + if ( $contLang->hasVariants() ) { + $variants = $contLang->getVariants(); foreach ( $variants as $vCode ) { - if ( $vCode == $wgContLang->getCode() ) { + if ( $vCode == $contLang->getCode() ) { continue; // we don't want default variant } $entry = $this->fileEntry( @@ -483,7 +485,9 @@ class GenerateSitemap extends Maintenance { */ function indexEntry( $filename ) { return "\t\n" . - "\t\t{$this->urlpath}$filename\n" . + "\t\t" . wfGetServerUrl( PROTO_CANONICAL ) . + ( substr( $this->urlpath, 0, 1 ) === "/" ? "" : "/" ) . + "{$this->urlpath}$filename\n" . "\t\t{$this->timestamp}\n" . "\t\n"; } @@ -539,7 +543,7 @@ class GenerateSitemap extends Maintenance { */ function generateLimit( $namespace ) { // T19961: make a title with the longest possible URL in this namespace - $title = Title::makeTitle( $namespace, str_repeat( "\xf0\xa8\xae\x81", 63 ) . "\xe5\x96\x83" ); + $title = Title::makeTitle( $namespace, str_repeat( "\u{28B81}", 63 ) . "\u{5583}" ); $this->limit = [ strlen( $this->openFile() ),