Last modified: 2011-02-26 10:40:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T28134, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 26134 - generateSitemap.php neglects newlines for unpopulated namespaces
generateSitemap.php neglects newlines for unpopulated namespaces
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
1.17.x
All All
: Low trivial (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-26 23:47 UTC by Dan Jacobson
Modified: 2011-02-26 10:40 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
add newline (802 bytes, patch)
2011-02-10 16:29 UTC, Sam Reed (reedy)
Details
hard to understand (282 bytes, text/plain)
2011-02-26 10:40 UTC, Dan Jacobson
Details

Description Dan Jacobson 2010-11-26 23:47:08 UTC
Gentlemen, let us observe what happens to the output one sees in reports
made to STDOUT (not the sitemaps themselves) by generateSitemap.php when
not all of the e.g.,
>$wgSitemapNamespaces=array(NS_MAIN,NS_PROJECT,NS_TEMPLATE_TALK,NS_HELP_TALK,NS_CATEGORY_TALK,NS_USER);
in ones LocalSettings.php are populated:

>0 ()	/home/jidanni/mediawiki/sitemap-mwabj-NS_0-0.xml.gz
>4 (ABJ)11 (Template talk)13 (Help talk)15 (Category talk)2 (User)	/home/jidanni/mediawiki/sitemap-mwabj-NS_2-0.xml.gz

The problem is if there are no items to print for a given namespace, the line
> $this->output( "\t$this->fspath$filename\n" );
will not fire, thus no "\n" will get printed. Thus the next line just
gets stuck upon the first, garbling the report!
Comment 1 Mark A. Hershberger 2011-02-10 01:39:41 UTC
Care to provide a patch if, and I do believe your tag, this is easy?
Comment 2 Sam Reed (reedy) 2011-02-10 02:14:25 UTC
reedy@ubuntu64-esxi:~/mediawiki/trunk/phase3/maintenance$ php generateSitemap.php
0 ()    /home/reedy/mediawiki/trunk/phase3/maintenance/sitemap-wikidb-mw_-NS_0-0.xml.gz
2 (User)        /home/reedy/mediawiki/trunk/phase3/maintenance/sitemap-wikidb-mw_-NS_2-0.xml.gz
6 (File)        /home/reedy/mediawiki/trunk/phase3/maintenance/sitemap-wikidb-mw_-NS_6-0.xml.gz
14 (Category)   /home/reedy/mediawiki/trunk/phase3/maintenance/sitemap-wikidb-mw_-NS_14-0.xml.gz




I'm failing to see an issue here? Please elabourate more
Comment 3 Dan Jacobson 2011-02-10 15:24:14 UTC
I dare not look at any more code, but instead just prove it to you again:
22:46 ~$ cd transgender-taiwan.org/maintenance/
22:46 maintenance$ php generateSitemap.php 
0 ()	/home/jidanni/mediawiki/maintenance/sitemap-transgender-NS_0-0.xml.gz
4 (蝶園)22:46 maintenance$ 
Note    ^the neglected newline?
That's because my namespace 4 just happens to have 0 articles on my wiki.

So try again with an unpopulated namespace or two added to the list of candidates.
Comment 4 Sam Reed (reedy) 2011-02-10 16:29:39 UTC
Ok, I can see that.

I'm just trying to replicate it. If I just add a new namespace, it doesn't generate a sitemap for it.

And just does the ones that do.

Have you done anything else to get it to appear there? Set it as a content namespace or anything?

Seemingly, the fix is
Change
$this->output( "\t$this->fspath$filename\n" );
to
$this->output( "\t$this->fspath$filename" );


And then add

$this->output( "\n" );

after the if.

I'll attach a patch, can you confirm if this fixes your issue?
Comment 5 Sam Reed (reedy) 2011-02-10 16:29:55 UTC
Created attachment 8121 [details]
add newline
Comment 6 Dan Jacobson 2011-02-10 17:09:58 UTC
Now it's
$ php generateSitemap.php 
0 ()	/home/jidanni/mediawiki/maintenance/sitemap-transgender-NS_0-0.xml.gz









4 (蝶園)01:08 maintenance$
Comment 7 Sam Reed (reedy) 2011-02-10 17:34:53 UTC
If you can tell me how to replicate the lack of a path being printed, i can try and help more
Comment 8 Dan Jacobson 2011-02-10 18:11:28 UTC
Fill up your $wgSitemapNamespaces=array(NS_MAIN,NS_PROJECT... with lots of never uses namespaces, then run generateSitemap.php, and post what you get.
Comment 9 Dan Jacobson 2011-02-10 18:13:21 UTC
It's ok that no path is printed. It is not OK that no newline is printed.
Comment 10 Chad H. 2011-02-10 18:20:37 UTC
What if we formatted the output like this (have local patch, looks ok to me)

maintenance chad$ php generateSitemap.php
0 ()
	/www/maintenance/sitemap-wikidb-mw_-NS_0-0.xml.gz
2 (User)
	/www/phase3/maintenance/sitemap-wikidb-mw_-NS_2-0.xml.gz
14 (Category)
3 (User talk)
	/www/phase3/maintenance/sitemap-wikidb-mw_-NS_3-0.xml.gz
maintenance chad$
Comment 11 Sam Reed (reedy) 2011-02-10 18:26:03 UTC
Chad, that looks a reasonably sane way of outputting it...
Comment 12 Dan Jacobson 2011-02-10 18:41:50 UTC
Why is it 0 2 14 3, and not 0 2 3 14?
Comment 13 Chad H. 2011-02-10 18:42:22 UTC
Because $wgSitemapNamespaces isn't sorted, and I put them in my list in a semi-random order.
Comment 14 Chad H. 2011-02-14 17:02:02 UTC
Done in r82115.
Comment 15 Dan Jacobson 2011-02-26 10:40:07 UTC
Created attachment 8215 [details]
hard to understand

I still say this is very hard to understand. Especially when done for more than one site. Perhaps a header could be added saying what the columns mean or something.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links