MediaWiki master
MediaWiki\Page\SitemapGenerator Class Reference

Utility for generating a sitemap. More...

Public Member Functions

 __construct (Language $contLang, LanguageConverterFactory $languageConverterFactory, GenderCache $genderCache,)
 
 additionalNamespaces (?array $namespaces)
 Add namespaces to the selected namespace list.
 
 getXml (IReadableDatabase $dbr)
 Use the previously set options to generate an XML sitemap.
 
 idRange (?int $startId, ?int $endId)
 Limit the page_id range to the given half-open interval.
 
 limit (int $limit)
 Limit the number of returned results.
 
 namespaces (?array $namespaces)
 Set the selected namespaces.
 
 namespacesFromConfig (Config $config)
 Set the included/excluded namespace list based on configuration.
 
 nextBatch ()
 If a previous call to getXml() reached the limit set by limit() and there were still more rows, calling this will advance an internal cursor to the start of the next batch, and return true.
 
 skipRedirects (bool $skip=true)
 Skip redirects.
 

Static Public Member Functions

static getVariants (Language $contLang, LanguageConverterFactory $languageConverterFactory,)
 

Detailed Description

Utility for generating a sitemap.

Access: internal

Definition at line 20 of file SitemapGenerator.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\SitemapGenerator::__construct ( Language $contLang,
LanguageConverterFactory $languageConverterFactory,
GenderCache $genderCache )

Member Function Documentation

◆ additionalNamespaces()

MediaWiki\Page\SitemapGenerator::additionalNamespaces ( ?array $namespaces)

Add namespaces to the selected namespace list.

If namespacesFromConfig() was already called, the selected namespace list will include namespaces from both $wgSitemapNamespaces and $namespaces.

Parameters
array | null$namespaces
Returns
$this

Definition at line 81 of file SitemapGenerator.php.

◆ getVariants()

static MediaWiki\Page\SitemapGenerator::getVariants ( Language $contLang,
LanguageConverterFactory $languageConverterFactory )
static

◆ getXml()

◆ idRange()

MediaWiki\Page\SitemapGenerator::idRange ( ?int $startId,
?int $endId )

Limit the page_id range to the given half-open interval.

Parameters
int | null$startIdThe start ID, or null for unlimited
int | null$endIdThe end ID, or null for unlimited. Only pages with a page_id less than this value will be returned.
Returns
$this

Definition at line 148 of file SitemapGenerator.php.

◆ limit()

MediaWiki\Page\SitemapGenerator::limit ( int $limit)

Limit the number of returned results.

Parameters
int$limit
Returns
$this

Definition at line 171 of file SitemapGenerator.php.

References MediaWiki\Page\SitemapGenerator\limit().

Referenced by MediaWiki\Page\SitemapGenerator\getXml(), and MediaWiki\Page\SitemapGenerator\limit().

◆ namespaces()

MediaWiki\Page\SitemapGenerator::namespaces ( ?array $namespaces)

Set the selected namespaces.

Parameters
int[] | null$namespaces
Returns
$this

Definition at line 68 of file SitemapGenerator.php.

◆ namespacesFromConfig()

MediaWiki\Page\SitemapGenerator::namespacesFromConfig ( Config $config)

Set the included/excluded namespace list based on configuration.

Parameters
Config$config
Returns
$this

Definition at line 96 of file SitemapGenerator.php.

References MediaWiki\MainConfigNames\DefaultRobotPolicy, MediaWiki\Config\Config\get(), MediaWiki\MainConfigNames\NamespaceRobotPolicies, and MediaWiki\MainConfigNames\SitemapNamespaces.

◆ nextBatch()

MediaWiki\Page\SitemapGenerator::nextBatch ( )

If a previous call to getXml() reached the limit set by limit() and there were still more rows, calling this will advance an internal cursor to the start of the next batch, and return true.

If there were no more rows, return false.

Returns
bool

Definition at line 185 of file SitemapGenerator.php.

◆ skipRedirects()

MediaWiki\Page\SitemapGenerator::skipRedirects ( bool $skip = true)

Skip redirects.

Parameters
bool$skip
Returns
$this

Definition at line 160 of file SitemapGenerator.php.

References MediaWiki\Page\SitemapGenerator\skipRedirects().

Referenced by MediaWiki\Page\SitemapGenerator\getXml(), and MediaWiki\Page\SitemapGenerator\skipRedirects().


The documentation for this class was generated from the following file: