X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FgenerateSitemap.php;h=aef45bff67c159a059407c2c8bc0997881f80343;hb=01048b0e4c6ce2cb535243c7fdacbb11aedb813b;hp=7d43f218c80d6569851ee30448c5c78c6a43ff98;hpb=956ffb9cd77bb9748cf7bc425d50f0eea7e3abdd;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index 7d43f218c8..aef45bff67 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -27,6 +27,7 @@ */ use MediaWiki\MediaWikiServices; +use Wikimedia\Rdbms\IResultWrapper; require_once __DIR__ . '/Maintenance.php'; @@ -187,18 +188,20 @@ class GenerateSitemap extends Maintenance { $this->fatalError( "Can not create directory $fspath." ); } + $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId(); $this->fspath = realpath( $fspath ) . DIRECTORY_SEPARATOR; $this->urlpath = $this->getOption( 'urlpath', "" ); if ( $this->urlpath !== "" && substr( $this->urlpath, -1 ) !== '/' ) { $this->urlpath .= '/'; } - $this->identifier = $this->getOption( 'identifier', wfWikiID() ); + $this->identifier = $this->getOption( 'identifier', $dbDomain ); $this->compress = $this->getOption( 'compress', 'yes' ) !== 'no'; $this->skipRedirects = $this->hasOption( 'skip-redirects' ); $this->dbr = $this->getDB( DB_REPLICA ); $this->generateNamespaces(); $this->timestamp = wfTimestamp( TS_ISO_8601, wfTimestampNow() ); - $this->findex = fopen( "{$this->fspath}sitemap-index-{$this->identifier}.xml", 'wb' ); + $encIdentifier = rawurlencode( $this->identifier ); + $this->findex = fopen( "{$this->fspath}sitemap-index-{$encIdentifier}.xml", 'wb' ); $this->main(); } @@ -299,7 +302,7 @@ class GenerateSitemap extends Maintenance { * Return a database resolution of all the pages in a given namespace * * @param int $namespace Limit the query to this namespace - * @return Resource + * @return IResultWrapper */ function getPageRes( $namespace ) { return $this->dbr->select( 'page',