X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FgenerateSitemap.php;h=12711ea3ff389acaa9e3f7a4aa47a55c851960e6;hb=f4344a2f67230b8cc3e4070371f9deb43358ef05;hp=1930a22a13ce963bf5627ca88557f10ffc5dc704;hpb=06811702cc90d4978d4ef4a7f266290928da751c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index 1930a22a13..12711ea3ff 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -181,7 +181,14 @@ class GenerateSitemap extends Maintenance { $this->setNamespacePriorities(); $this->url_limit = 50000; $this->size_limit = pow( 2, 20 ) * 10; - $this->fspath = self::init_path( $this->getOption( 'fspath', getcwd() ) ); + + # Create directory if needed + $fspath = $this->getOption( 'fspath', getcwd() ); + if ( !wfMkdirParents( $fspath, null, __METHOD__ ) ) { + $this->error( "Can not create directory $fspath.", 1 ); + } + + $this->fspath = realpath( $fspath ) . DIRECTORY_SEPARATOR; $this->urlpath = $this->getOption( 'urlpath', "" ); if ( $this->urlpath !== "" && substr( $this->urlpath, -1 ) !== '/' ) { $this->urlpath .= '/'; @@ -238,20 +245,6 @@ class GenerateSitemap extends Maintenance { } } - /** - * Create directory if it does not exist and return pathname with a trailing slash - * @param string $fspath - * @return null|string - */ - private static function init_path( $fspath ) { - # Create directory if needed - if ( $fspath && !is_dir( $fspath ) ) { - wfMkdirParents( $fspath, null, __METHOD__ ) or die( "Can not create directory $fspath.\n" ); - } - - return realpath( $fspath ) . DIRECTORY_SEPARATOR; - } - /** * Generate a one-dimensional array of existing namespaces */