X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FgenerateSitemap.php;h=30d6f73cab90f5bb4e193ba06c2085c417e19bf4;hb=c169c8584ef8e043a40b8f9f6052db3e5937dc00;hp=5667dd027cacdd72c02d8df82090c211f01961b8;hpb=26ad01bfa3a7e7ad6b7dc3d2530055aff3f9d821;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index 5667dd027c..30d6f73cab 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -57,11 +57,11 @@ class GenerateSitemap extends Maintenance { var $fspath; /** - * The path to append to the domain name + * The URL path to prepend to filenames in the index; should resolve to the same directory as $fspath * * @var string */ - var $path; + var $urlpath; /** * Whether or not to use compression @@ -126,8 +126,8 @@ class GenerateSitemap extends Maintenance { public function __construct() { parent::__construct(); $this->mDescription = "Creates a sitemap for the site"; - $this->addOption( 'fspath', 'The file system path to save to, e.g. /tmp/sitemap' . - "\n\t\tdefaults to current directory", false, true ); + $this->addOption( 'fspath', 'The file system path to save to, e.g. /tmp/sitemap; defaults to current directory', false, true ); + $this->addOption( 'urlpath', 'The URL path corresponding to --fspath, prepended to filenames in the index; defaults to an empty string', false, true ); $this->addOption( 'compress', 'Compress the sitemap files, can take value yes|no, default yes', false, true ); } @@ -139,6 +139,10 @@ class GenerateSitemap extends Maintenance { $this->url_limit = 50000; $this->size_limit = pow( 2, 20 ) * 10; $this->fspath = self::init_path( $this->getOption( 'fspath', getcwd() ) ); + $this->urlpath = $this->getOption( 'urlpath', "" ); + if ( $this->urlpath !== "" && substr( $this->urlpath, -1 ) !== '/' ) { + $this->urlpath .= '/'; + } $this->compress = $this->getOption( 'compress', 'yes' ) !== 'no'; $this->dbr = wfGetDB( DB_SLAVE ); $this->generateNamespaces(); @@ -384,7 +388,7 @@ class GenerateSitemap extends Maintenance { function indexEntry( $filename ) { return "\t\n" . - "\t\t$filename\n" . + "\t\t{$this->urlpath}$filename\n" . "\t\t{$this->timestamp}\n" . "\t\n"; }