From cecb985bee3bdd252e1b8dc0bd500b37cd52be01 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 16 May 2007 20:58:53 +0000 Subject: Aktualisierung auf MediaWiki 1.10.0 Plugins angepasst und verbessert kleine Korrekturen am Design --- maintenance/generateSitemap.php | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'maintenance/generateSitemap.php') diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index b8d6a5d6..7fff0069 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -4,8 +4,7 @@ define( 'GS_TALK', -1 ); /** * Creates a Google sitemap for the site * - * @package MediaWiki - * @subpackage Maintenance + * @addtogroup Maintenance * * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason * @copyright Copyright © 2005, Jens Frank @@ -144,17 +143,16 @@ class GenerateSitemap { * @param string $path The path to append to the domain name * @param bool $compress Whether to compress the sitemap files */ - function GenerateSitemap( $fspath, $path, $compress ) { + function GenerateSitemap( $fspath, $compress ) { global $wgScriptPath; $this->url_limit = 50000; $this->size_limit = pow( 2, 20 ) * 10; $this->fspath = isset( $fspath ) ? $fspath : ''; - $this->path = isset( $path ) ? $path : $wgScriptPath; $this->compress = $compress; $this->stderr = fopen( 'php://stderr', 'wt' ); - $this->dbr =& wfGetDB( DB_SLAVE ); + $this->dbr = wfGetDB( DB_SLAVE ); $this->generateNamespaces(); $this->timestamp = wfTimestamp( TS_ISO_8601, wfTimestampNow() ); $this->findex = fopen( "{$this->fspath}sitemap-index-" . wfWikiID() . ".xml", 'wb' ); @@ -448,23 +446,29 @@ class GenerateSitemap { } if ( in_array( '--help', $argv ) ) { - echo - "Usage: php generateSitemap.php [host] [options]\n" . - "\thost = hostname\n" . - "\toptions:\n" . - "\t\t--help\tshow this message\n" . - "\t\t--fspath\tThe file system path to save to, e.g /tmp/sitemap/\n" . - "\t\t--path\tThe http path to use, e.g. /wiki\n" . - "\t\t--compress=[yes|no]\tcompress the sitemap files, default yes\n"; + echo << The file system path to save to, e.g /tmp/sitemap/ + + --server= The protocol and server name to use in URLs, e.g. + http://en.wikipedia.org. This is sometimes necessary because + server name detection may fail in command line scripts. + + --compress=[yes|no] compress the sitemap files, default yes + +EOT; die( -1 ); } -if ( isset( $argv[1] ) && strpos( $argv[1], '--' ) !== 0 ) - $_SERVER['SERVER_NAME'] = $argv[1]; +$optionsWithArgs = array( 'fspath', 'server', 'compress' ); +require_once( dirname( __FILE__ ) . '/commandLine.inc' ); -$optionsWithArgs = array( 'fspath', 'path', 'compress' ); -require_once 'commandLine.inc'; +if ( isset( $options['server'] ) ) { + $wgServer = $options['server']; +} -$gs = new GenerateSitemap( @$options['fspath'], @$options['path'], @$options['compress'] !== 'no' ); +$gs = new GenerateSitemap( @$options['fspath'], @$options['compress'] !== 'no' ); $gs->main(); ?> -- cgit v1.2.2