MediaWiki  REL1_22
GenerateSitemap Class Reference

Maintenance script that generates a sitemap for the site. More...

Inheritance diagram for GenerateSitemap:
Collaboration diagram for GenerateSitemap:

List of all members.

Public Member Functions

 __construct ()
 Constructor.
 close (&$handle)
 gzclose() / fclose() wrapper
 closeFile ()
 Return the XML required to close sitemap file.
 closeIndex ()
 Return the XML required to close a sitemap index file.
 execute ()
 Execute.
 fileEntry ($url, $date, $priority)
 Return the XML for a single sitemap entry.
 generateLimit ($namespace)
 Populate $this->limit.
 generateNamespaces ()
 Generate a one-dimensional array of existing namespaces.
 getPageRes ($namespace)
 Return a database resolution of all the pages in a given namespace.
 guessPriority ($namespace)
 If the namespace isn't listed on the priority list return the default priority for the namespace, varies depending on whether it's a talkpage or not.
 indexEntry ($filename)
 Return the XML for a single sitemap indexfile entry.
 main ()
 Main loop.
 open ($file, $flags)
 gzopen() / fopen() wrapper
 openFile ()
 Return the XML required to open a sitemap file.
 openIndex ()
 Return the XML required to open a sitemap index file.
 priority ($namespace)
 Get the priority of a given namespace.
 sitemapFilename ($namespace, $count)
 Get a sitemap filename.
 write (&$handle, $str)
 gzwrite() / fwrite() wrapper
 xmlHead ()
 Return the XML required to open an XML file.
 xmlSchema ()
 Return the XML schema being used.

Public Attributes

bool $compress
 Whether or not to use compression.
object $dbr
 A database slave object.
resource $file
 A resource pointing to a sitemap file.
resource $findex
 A resource pointing to the sitemap index file.
string $fspath
 The path to prepend to the filename.
array $limit = array()
 The number of entries to save in each sitemap file.
array $namespaces = array()
 A one-dimensional array of namespaces in the wiki.
array $priorities = array()
 Key => value entries of namespaces and their priorities.
int $size_limit
 The maximum size of a sitemap file.
bool $skipRedirects
 Whether or not to include redirection pages.
string $timestamp
 When this sitemap batch was generated.
int $url_limit
 The maximum amount of urls in a sitemap file.
string $urlpath
 The URL path to prepend to filenames in the index; should resolve to the same directory as $fspath.
const GS_MAIN = -2
const GS_TALK = -1

Private Member Functions

 setNamespacePriorities ()

Static Private Member Functions

static init_path ($fspath)
 Create directory if it does not exist and return pathname with a trailing slash.

Private Attributes

string $identifier
 Identifier to use in filenames, default $wgDBname.

Detailed Description

Maintenance script that generates a sitemap for the site.

Definition at line 36 of file generateSitemap.php.


Constructor & Destructor Documentation

Constructor.

Reimplemented from Maintenance.

Definition at line 132 of file generateSitemap.php.


Member Function Documentation

GenerateSitemap::close ( &$  handle)

gzclose() / fclose() wrapper

Definition at line 389 of file generateSitemap.php.

Referenced by open().

Return the XML required to close sitemap file.

Returns:
String

Definition at line 491 of file generateSitemap.php.

Referenced by open().

Return the XML required to close a sitemap index file.

Returns:
String

Definition at line 455 of file generateSitemap.php.

Execute.

Reimplemented from Maintenance.

Definition at line 145 of file generateSitemap.php.

GenerateSitemap::fileEntry ( url,
date,
priority 
)

Return the XML for a single sitemap entry.

Parameters:
$urlString: an RFC 2396 compliant URL
$dateString: a ISO 8601 date
$priorityString: a priority indicator, 0.0 - 1.0 inclusive with a 0.1 stepsize
Returns:
String

Definition at line 476 of file generateSitemap.php.

Populate $this->limit.

Definition at line 498 of file generateSitemap.php.

Generate a one-dimensional array of existing namespaces.

Definition at line 226 of file generateSitemap.php.

GenerateSitemap::getPageRes ( namespace)

Return a database resolution of all the pages in a given namespace.

Parameters:
$namespaceInteger: limit the query to this namespace
Returns:
Resource

Definition at line 277 of file generateSitemap.php.

If the namespace isn't listed on the priority list return the default priority for the namespace, varies depending on whether it's a talkpage or not.

Parameters:
$namespaceInteger: the namespace to get the priority for
Returns:
String

Definition at line 267 of file generateSitemap.php.

GenerateSitemap::indexEntry ( filename)

Return the XML for a single sitemap indexfile entry.

Parameters:
$filenameString: the filename of the sitemap file
Returns:
String

Definition at line 442 of file generateSitemap.php.

static GenerateSitemap::init_path ( fspath) [static, private]

Create directory if it does not exist and return pathname with a trailing slash.

Parameters:
$fspathstring
Returns:
null|string

Definition at line 211 of file generateSitemap.php.

Main loop.

Definition at line 293 of file generateSitemap.php.

GenerateSitemap::open ( file,
flags 
)

gzopen() / fopen() wrapper

Returns:
Resource

Definition at line 364 of file generateSitemap.php.

References close(), closeFile(), file, and write().

Return the XML required to open a sitemap file.

Returns:
String

Definition at line 464 of file generateSitemap.php.

Return the XML required to open a sitemap index file.

Returns:
String

Definition at line 432 of file generateSitemap.php.

GenerateSitemap::priority ( namespace)

Get the priority of a given namespace.

Parameters:
$namespaceInteger: the namespace to get the priority for
Returns:
String

Definition at line 255 of file generateSitemap.php.

References namespaces.

Definition at line 164 of file generateSitemap.php.

GenerateSitemap::sitemapFilename ( namespace,
count 
)

Get a sitemap filename.

Parameters:
$namespaceInteger: the namespace
$countInteger: the count
Returns:
String

Definition at line 404 of file generateSitemap.php.

GenerateSitemap::write ( &$  handle,
str 
)

gzwrite() / fwrite() wrapper

Definition at line 375 of file generateSitemap.php.

Referenced by open().

Return the XML required to open an XML file.

Returns:
string

Definition at line 414 of file generateSitemap.php.

Return the XML schema being used.

Returns:
String

Definition at line 423 of file generateSitemap.php.


Member Data Documentation

bool GenerateSitemap::$compress

Whether or not to use compression.

Definition at line 72 of file generateSitemap.php.

object GenerateSitemap::$dbr

A database slave object.

Definition at line 108 of file generateSitemap.php.

resource GenerateSitemap::$file

A resource pointing to a sitemap file.

Definition at line 121 of file generateSitemap.php.

resource GenerateSitemap::$findex

A resource pointing to the sitemap index file.

Definition at line 114 of file generateSitemap.php.

string GenerateSitemap::$fspath

The path to prepend to the filename.

Definition at line 60 of file generateSitemap.php.

string GenerateSitemap::$identifier [private]

Identifier to use in filenames, default $wgDBname.

Definition at line 127 of file generateSitemap.php.

array GenerateSitemap::$limit = array()

The number of entries to save in each sitemap file.

Definition at line 84 of file generateSitemap.php.

array GenerateSitemap::$namespaces = array()

A one-dimensional array of namespaces in the wiki.

Definition at line 96 of file generateSitemap.php.

array GenerateSitemap::$priorities = array()

Key => value entries of namespaces and their priorities.

Definition at line 90 of file generateSitemap.php.

int GenerateSitemap::$size_limit

The maximum size of a sitemap file.

http://www.sitemaps.org/faq.php#faq_sitemap_size

Definition at line 54 of file generateSitemap.php.

bool GenerateSitemap::$skipRedirects

Whether or not to include redirection pages.

Definition at line 78 of file generateSitemap.php.

string GenerateSitemap::$timestamp

When this sitemap batch was generated.

Definition at line 102 of file generateSitemap.php.

int GenerateSitemap::$url_limit

The maximum amount of urls in a sitemap file.

http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd

Definition at line 46 of file generateSitemap.php.

string GenerateSitemap::$urlpath

The URL path to prepend to filenames in the index; should resolve to the same directory as $fspath.

Definition at line 66 of file generateSitemap.php.

Definition at line 37 of file generateSitemap.php.

Definition at line 38 of file generateSitemap.php.


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