MediaWiki  REL1_24
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

Parameters:
resource$handle

Definition at line 428 of file generateSitemap.php.

Return the XML required to close sitemap file.

Returns:
string

Definition at line 531 of file generateSitemap.php.

Return the XML required to close a sitemap index file.

Returns:
string

Definition at line 495 of file generateSitemap.php.

Execute.

Reimplemented from Maintenance.

Definition at line 166 of file generateSitemap.php.

GenerateSitemap::fileEntry ( url,
date,
priority 
)

Return the XML for a single sitemap entry.

Parameters:
string$urlAn RFC 2396 compliant URL
string$dateA ISO 8601 date
string$priorityA priority indicator, 0.0 - 1.0 inclusive with a 0.1 stepsize
Returns:
string

Definition at line 516 of file generateSitemap.php.

Populate $this->limit.

Parameters:
int$namespace

Definition at line 540 of file generateSitemap.php.

Generate a one-dimensional array of existing namespaces.

Definition at line 244 of file generateSitemap.php.

GenerateSitemap::getPageRes ( namespace)

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

Parameters:
int$namespaceLimit the query to this namespace
Returns:
Resource

Definition at line 300 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:
int$namespaceThe namespace to get the priority for
Returns:
string

Definition at line 288 of file generateSitemap.php.

GenerateSitemap::indexEntry ( filename)

Return the XML for a single sitemap indexfile entry.

Parameters:
string$filenameThe filename of the sitemap file
Returns:
string

Definition at line 482 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:
string$fspath
Returns:
null|string

Definition at line 232 of file generateSitemap.php.

Main loop.

Definition at line 316 of file generateSitemap.php.

GenerateSitemap::open ( file,
flags 
)

gzopen() / fopen() wrapper

Parameters:
string$file
string$flags
Returns:
resource

Definition at line 396 of file generateSitemap.php.

Return the XML required to open a sitemap file.

Returns:
string

Definition at line 504 of file generateSitemap.php.

Return the XML required to open a sitemap index file.

Returns:
string

Definition at line 472 of file generateSitemap.php.

GenerateSitemap::priority ( namespace)

Get the priority of a given namespace.

Parameters:
int$namespaceThe namespace to get the priority for
Returns:
string

Definition at line 274 of file generateSitemap.php.

References namespaces.

Definition at line 185 of file generateSitemap.php.

GenerateSitemap::sitemapFilename ( namespace,
count 
)

Get a sitemap filename.

Parameters:
int$namespaceThe namespace
int$countThe count
Returns:
string

Definition at line 443 of file generateSitemap.php.

GenerateSitemap::write ( &$  handle,
str 
)

gzwrite() / fwrite() wrapper

Parameters:
resource$handle
string$str

Definition at line 412 of file generateSitemap.php.

Return the XML required to open an XML file.

Returns:
string

Definition at line 454 of file generateSitemap.php.

Return the XML schema being used.

Returns:
string

Definition at line 463 of file generateSitemap.php.


Member Data Documentation

bool GenerateSitemap::$compress

Whether or not to use compression.

Definition at line 73 of file generateSitemap.php.

object GenerateSitemap::$dbr

A database slave object.

Definition at line 109 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 115 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 85 of file generateSitemap.php.

array GenerateSitemap::$namespaces = array()

A one-dimensional array of namespaces in the wiki.

Definition at line 97 of file generateSitemap.php.

array GenerateSitemap::$priorities = array()

Key => value entries of namespaces and their priorities.

Definition at line 91 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 79 of file generateSitemap.php.

string GenerateSitemap::$timestamp

When this sitemap batch was generated.

Definition at line 103 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 67 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: