* @see http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
*/
-require_once( __DIR__ . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
/**
* Maintenance script that generates a sitemap for the site.
*/
public $findex;
-
/**
* A resource pointing to a sitemap file
*
function open( $file, $flags ) {
$resource = $this->compress ? gzopen( $file, $flags ) : fopen( $file, $flags );
if ( $resource === false ) {
- wfDebugDieBacktrace( __METHOD__ . " error opening file $file with flags $flags. Check permissions?" );
+ throw new MWException( __METHOD__ . " error opening file $file with flags $flags. Check permissions?" );
}
return $resource;
}
*/
function write( &$handle, $str ) {
if ( $handle === true || $handle === false ) {
- wfDebugDieBacktrace( __METHOD__ . " was passed a boolean as a file handle.\n" );
+ throw new MWException( __METHOD__ . " was passed a boolean as a file handle.\n" );
}
if ( $this->compress ) {
gzwrite( $handle, $str );
function fileEntry( $url, $date, $priority ) {
return
"\t<url>\n" .
- "\t\t<loc>$url</loc>\n" .
+ // bug 34666: $url may contain bad characters such as ampersands.
+ "\t\t<loc>" . htmlspecialchars( $url ) . "</loc>\n" .
"\t\t<lastmod>$date</lastmod>\n" .
"\t\t<priority>$priority</priority>\n" .
"\t</url>\n";
}
$maintClass = "GenerateSitemap";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;