X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FgenerateSitemap.php;h=b356d1869231ba132dee3e967b38cc9c05c20a3b;hb=d8cb9695c6971975692808bb7cdc991e2abda0ab;hp=adea97eaf7612689e2e58248fe0bbf4831eb248f;hpb=3df2c2c3614c3d53c25f2cf5b4a257db3662dc62;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index adea97eaf7..b356d18692 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -167,7 +167,7 @@ class GenerateSitemap extends Maintenance { } $this->identifier = $this->getOption( 'identifier', wfWikiID() ); $this->compress = $this->getOption( 'compress', 'yes' ) !== 'no'; - $this->skipRedirects = $this->getOption( 'skip-redirects', false ) !== false ; + $this->skipRedirects = $this->getOption( 'skip-redirects', false ) !== false; $this->dbr = wfGetDB( DB_SLAVE ); $this->generateNamespaces(); $this->timestamp = wfTimestamp( TS_ISO_8601, wfTimestampNow() ); @@ -231,7 +231,7 @@ class GenerateSitemap extends Maintenance { wfMkdirParents( $fspath, null, __METHOD__ ) or die( "Can not create directory $fspath.\n" ); } - return realpath( $fspath ) . DIRECTORY_SEPARATOR ; + return realpath( $fspath ) . DIRECTORY_SEPARATOR; } /** @@ -255,8 +255,9 @@ class GenerateSitemap extends Maintenance { ) ); - foreach ( $res as $row ) + foreach ( $res as $row ) { $this->namespaces[] = $row->page_namespace; + } } /** @@ -319,7 +320,7 @@ class GenerateSitemap extends Maintenance { $this->output( "$namespace ($fns)\n" ); $skippedRedirects = 0; // Number of redirects skipped for that namespace foreach ( $res as $row ) { - if ($this->skipRedirects && $row->page_is_redirect ) { + if ( $this->skipRedirects && $row->page_is_redirect ) { $skippedRedirects++; continue; } @@ -346,7 +347,9 @@ class GenerateSitemap extends Maintenance { if ( $wgContLang->hasVariants() ) { $variants = $wgContLang->getVariants(); foreach ( $variants as $vCode ) { - if ( $vCode == $wgContLang->getCode() ) continue; // we don't want default variant + if ( $vCode == $wgContLang->getCode() ) { + continue; // we don't want default variant + } $entry = $this->fileEntry( $title->getCanonicalURL( '', $vCode ), $date, $this->priority( $namespace ) ); $length += strlen( $entry ); $this->write( $this->file, $entry ); @@ -354,7 +357,7 @@ class GenerateSitemap extends Maintenance { } } - if ($this->skipRedirects && $skippedRedirects > 0) { + if ( $this->skipRedirects && $skippedRedirects > 0 ) { $this->output( " skipped $skippedRedirects redirect(s)\n" ); } @@ -374,7 +377,7 @@ class GenerateSitemap extends Maintenance { */ function open( $file, $flags ) { $resource = $this->compress ? gzopen( $file, $flags ) : fopen( $file, $flags ); - if( $resource === false ) { + if ( $resource === false ) { wfDebugDieBacktrace( __METHOD__ . " error opening file $file with flags $flags. Check permissions?" ); } return $resource; @@ -384,23 +387,25 @@ class GenerateSitemap extends Maintenance { * gzwrite() / fwrite() wrapper */ function write( &$handle, $str ) { - if( $handle === true || $handle === false ) { + if ( $handle === true || $handle === false ) { wfDebugDieBacktrace( __METHOD__ . " was passed a boolean as a file handle.\n" ); } - if ( $this->compress ) + if ( $this->compress ) { gzwrite( $handle, $str ); - else + } else { fwrite( $handle, $str ); + } } /** * gzclose() / fclose() wrapper */ function close( &$handle ) { - if ( $this->compress ) + if ( $this->compress ) { gzclose( $handle ); - else + } else { fclose( $handle ); + } } /**