GenerateSitemap Class Reference
[Maintenance]

Creates a sitemap for the site. More...

List of all members.

Public Member Functions

 GenerateSitemap ($fspath, $compress)
 Constructor.
 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.
 debug ($str)
 Write a string to stderr followed by a UNIX newline.
 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
 $namespaces = array()
 $timestamp
 $dbr
 $findex
 $file
 $stderr

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.

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 19 of file generateSitemap.php.


Member Function Documentation

GenerateSitemap::close ( &$  handle  ) 

gzclose() / fclose() wrapper

Definition at line 332 of file generateSitemap.php.

Referenced by main().

GenerateSitemap::closeFile (  )  [static]

Return the XML required to close sitemap file.

Returns:
string

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

Referenced by main().

GenerateSitemap::debug ( str  ) 

Write a string to stderr followed by a UNIX newline.

Definition at line 455 of file generateSitemap.php.

Referenced by main().

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 433 of file generateSitemap.php.

Referenced by generateLimit(), and main().

GenerateSitemap::generateLimit ( namespace  ) 

Populate $this->limit.

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

References $fname, $res, $row, and $wgSitemapNamespaces.

Referenced by GenerateSitemap().

GenerateSitemap::GenerateSitemap ( fspath,
compress 
)

Constructor.

Parameters:
string $fspath The path to prepend to the filenames, used to save them somewhere else than in the root directory
string $path The path to append to the domain name
bool $compress Whether to compress the sitemap files

Definition at line 146 of file generateSitemap.php.

References $compress, $fspath, $wgScriptPath, generateNamespaces(), init_path(), wfGetDB(), wfTimestamp(), wfTimestampNow(), and wfWikiID().

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 238 of file generateSitemap.php.

References $fname.

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 227 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 394 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 167 of file generateSitemap.php.

References $fspath.

Referenced by GenerateSitemap().

GenerateSitemap::main (  ) 

GenerateSitemap::open ( file,
flags 
)

gzopen() / fopen() wrapper

Returns:
resource

Definition at line 315 of file generateSitemap.php.

References $file, and $flags.

Referenced by main().

GenerateSitemap::openFile (  ) 

Return the XML required to open a sitemap file.

Returns:
string

Definition at line 418 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 381 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 214 of file generateSitemap.php.

References guessPriority().

Referenced by generateLimit(), and main().

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

Get a sitemap filename.

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

Definition at line 349 of file generateSitemap.php.

References $ext.

Referenced by main().

GenerateSitemap::write ( &$  handle,
str 
)

gzwrite() / fwrite() wrapper

Definition at line 322 of file generateSitemap.php.

Referenced by main().

GenerateSitemap::xmlHead (  )  [static]

Return the XML required to open an XML file.

Returns:
string

Definition at line 361 of file generateSitemap.php.

Referenced by openFile(), and openIndex().

GenerateSitemap::xmlSchema (  )  [static]

Return the XML schema being used.

Returns:
string

Definition at line 372 of file generateSitemap.php.

Referenced by openFile(), and openIndex().


Member Data Documentation

GenerateSitemap::$compress

Definition at line 57 of file generateSitemap.php.

Referenced by GenerateSitemap().

GenerateSitemap::$dbr

Definition at line 114 of file generateSitemap.php.

GenerateSitemap::$file

Definition at line 129 of file generateSitemap.php.

Referenced by open().

GenerateSitemap::$findex

Definition at line 121 of file generateSitemap.php.

GenerateSitemap::$fspath

Definition at line 43 of file generateSitemap.php.

Referenced by GenerateSitemap(), and init_path().

GenerateSitemap::$limit = array()

Definition at line 64 of file generateSitemap.php.

GenerateSitemap::$namespaces = array()

Definition at line 100 of file generateSitemap.php.

GenerateSitemap::$path

Definition at line 50 of file generateSitemap.php.

GenerateSitemap::$priorities

Initial value:

 array(
                
                GS_MAIN                 => '0.5',
                
                GS_TALK                 => '0.1',
                
                NS_MAIN                 => '1.0',
                NS_TALK                 => '0.1',
                NS_USER                 => '0.5',
                NS_USER_TALK            => '0.1',
                NS_PROJECT              => '0.5',
                NS_PROJECT_TALK         => '0.1',
                NS_FILE                 => '0.5',
                NS_FILE_TALK            => '0.1',
                NS_MEDIAWIKI            => '0.0',
                NS_MEDIAWIKI_TALK       => '0.1',
                NS_TEMPLATE             => '0.0',
                NS_TEMPLATE_TALK        => '0.1',
                NS_HELP                 => '0.5',
                NS_HELP_TALK            => '0.1',
                NS_CATEGORY             => '0.5',
                NS_CATEGORY_TALK        => '0.1',
        )

Definition at line 71 of file generateSitemap.php.

GenerateSitemap::$size_limit

Definition at line 36 of file generateSitemap.php.

GenerateSitemap::$stderr

Definition at line 136 of file generateSitemap.php.

GenerateSitemap::$timestamp

Definition at line 107 of file generateSitemap.php.

GenerateSitemap::$url_limit

Definition at line 27 of file generateSitemap.php.


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

Generated on Sat Sep 5 02:08:38 2009 for MediaWiki by  doxygen 1.5.9