GenerateSitemap Class Reference

Creates a sitemap for the site. More...

Inherits Maintenance.

List of all members.

Public Member Functions

 __construct ()
 Constructor.
 execute ()
 Execute.
 generateNamespaces ()
 Generate a one-dimensional array of existing namespaces.
 priority ($namespace)
 Get the priority of 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.
 getPageRes ($namespace)
 Return a database resolution of all the pages in a given namespace.
 main ()
 Main loop.
 open ($file, $flags)
 gzopen() / fopen() wrapper
 write (&$handle, $str)
 gzwrite() / fwrite() wrapper
 close (&$handle)
 gzclose() / fclose() wrapper
 openIndex ()
 Return the XML required to open a sitemap index file.
 openFile ()
 Return the XML required to open a sitemap file.
 generateLimit ($namespace)
 Populate $this->limit.

Static Public Member Functions

 sitemapFilename ($namespace, $count)
 Get a sitemap filename.
 xmlHead ()
 Return the XML required to open an XML file.
 xmlSchema ()
 Return the XML schema being used.
 indexEntry ($filename)
 Return the XML for a single sitemap indexfile entry.
 closeIndex ()
 Return the XML required to close a sitemap index file.
 fileEntry ($url, $date, $priority)
 Return the XML for a single sitemap entry.
 closeFile ()
 Return the XML required to close sitemap file.

Public Attributes

 $url_limit
 $size_limit
 $fspath
 $path
 $compress
 $limit = array()
 $priorities = array()
 $namespaces = array()
 $timestamp
 $dbr
 $findex
 $file

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.


Detailed Description

Creates a sitemap for the site.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Copyright © 2005, Ævar Arnfjörð Bjarmason Copyright © 2005, Jens Frank <jeluf@gmx.de> Copyright © 2005, Brion Vibber <brion@pobox.com>

See also:
http://www.sitemaps.org/

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

http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later

Definition at line 36 of file generateSitemap.php.


Constructor & Destructor Documentation

GenerateSitemap::__construct (  ) 

Constructor.

Reimplemented from Maintenance.

Definition at line 129 of file generateSitemap.php.

References Maintenance::addOption().


Member Function Documentation

GenerateSitemap::close ( &$  handle  ) 

gzclose() / fclose() wrapper

Definition at line 342 of file generateSitemap.php.

Referenced by main().

GenerateSitemap::closeFile (  )  [static]

Return the XML required to close sitemap file.

Returns:
string

Definition at line 458 of file generateSitemap.php.

Referenced by generateLimit(), and main().

GenerateSitemap::closeIndex (  )  [static]

Return the XML required to close a sitemap index file.

Returns:
string

Definition at line 419 of file generateSitemap.php.

Referenced by main().

GenerateSitemap::execute (  ) 

GenerateSitemap::fileEntry ( url,
date,
priority 
) [static]

Return the XML for a single sitemap entry.

Parameters:
string $url An RFC 2396 compliant URL
string $date A ISO 8601 date
string $priority A priority indicator, 0.0 - 1.0 inclusive with a 0.1 stepsize
Returns:
string

Definition at line 443 of file generateSitemap.php.

Referenced by generateLimit(), and main().

GenerateSitemap::generateLimit ( namespace  ) 

Populate $this->limit.

Definition at line 465 of file generateSitemap.php.

References $title, closeFile(), fileEntry(), Title::makeTitle(), openFile(), priority(), and wfTimestamp().

Referenced by main().

GenerateSitemap::generateNamespaces (  ) 

Generate a one-dimensional array of existing namespaces.

Definition at line 196 of file generateSitemap.php.

References $res, and $wgSitemapNamespaces.

Referenced by execute().

GenerateSitemap::getPageRes ( namespace  ) 

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

Parameters:
int $namespace Limit the query to this namespace
Returns:
resource

Definition at line 250 of file generateSitemap.php.

Referenced by main().

GenerateSitemap::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.

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

Definition at line 239 of file generateSitemap.php.

References MWNamespace::isMain().

Referenced by priority().

GenerateSitemap::indexEntry ( filename  )  [static]

Return the XML for a single sitemap indexfile entry.

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

Definition at line 404 of file generateSitemap.php.

Referenced by main().

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

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

Definition at line 181 of file generateSitemap.php.

References $fspath, and wfMkdirParents().

Referenced by execute().

GenerateSitemap::main (  ) 

GenerateSitemap::open ( file,
flags 
)

gzopen() / fopen() wrapper

Returns:
resource

Definition at line 325 of file generateSitemap.php.

References $file.

Referenced by main().

GenerateSitemap::openFile (  ) 

Return the XML required to open a sitemap file.

Returns:
string

Definition at line 428 of file generateSitemap.php.

References xmlHead(), and xmlSchema().

Referenced by generateLimit(), and main().

GenerateSitemap::openIndex (  ) 

Return the XML required to open a sitemap index file.

Returns:
string

Definition at line 391 of file generateSitemap.php.

References xmlHead(), and xmlSchema().

Referenced by main().

GenerateSitemap::priority ( namespace  ) 

Get the priority of a given namespace.

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

Definition at line 226 of file generateSitemap.php.

References guessPriority().

Referenced by generateLimit(), and main().

GenerateSitemap::setNamespacePriorities (  )  [private]

Definition at line 154 of file generateSitemap.php.

Referenced by execute().

GenerateSitemap::sitemapFilename ( namespace,
count 
) [static]

Get a sitemap filename.

Parameters:
int $namespace The namespace
int $count The count
Returns:
string

Definition at line 359 of file generateSitemap.php.

References $ext.

Referenced by main().

GenerateSitemap::write ( &$  handle,
str 
)

gzwrite() / fwrite() wrapper

Definition at line 332 of file generateSitemap.php.

Referenced by main().

GenerateSitemap::xmlHead (  )  [static]

Return the XML required to open an XML file.

Returns:
string

Definition at line 371 of file generateSitemap.php.

Referenced by openFile(), and openIndex().

GenerateSitemap::xmlSchema (  )  [static]

Return the XML schema being used.

Returns:
string

Definition at line 382 of file generateSitemap.php.

Referenced by openFile(), and openIndex().


Member Data Documentation

GenerateSitemap::$compress

Definition at line 74 of file generateSitemap.php.

GenerateSitemap::$dbr

Definition at line 109 of file generateSitemap.php.

GenerateSitemap::$file

Definition at line 124 of file generateSitemap.php.

Referenced by open().

GenerateSitemap::$findex

Definition at line 116 of file generateSitemap.php.

GenerateSitemap::$fspath

Definition at line 60 of file generateSitemap.php.

Referenced by init_path().

GenerateSitemap::$limit = array()

Definition at line 81 of file generateSitemap.php.

GenerateSitemap::$namespaces = array()

Definition at line 95 of file generateSitemap.php.

GenerateSitemap::$path

Definition at line 67 of file generateSitemap.php.

GenerateSitemap::$priorities = array()

Definition at line 88 of file generateSitemap.php.

GenerateSitemap::$size_limit

Definition at line 53 of file generateSitemap.php.

GenerateSitemap::$timestamp

Definition at line 102 of file generateSitemap.php.

GenerateSitemap::$url_limit

Definition at line 44 of file generateSitemap.php.


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

Generated on Sat Apr 30 22:57:38 2011 for MediaWiki by  doxygen 1.5.9