r86534 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86533‎ | r86534 | r86535 >
Date:19:43, 20 April 2011
Author:bawolff
Status:resolved (Comments)
Tags:
Comment:
(bug 23816) Add tracking category for any page with a broken image.

Note this considers a link to a non-existent image to be broken. A link
to an image that exists but does not have a handler is not considered broken.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesQqq.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -157,6 +157,7 @@
158158 'listingcontinuesabbrev',
159159 'index-category',
160160 'noindex-category',
 161+ 'broken-file-category',
161162 ),
162163 'mainpage' => array(
163164 'linkprefix',
Index: trunk/phase3/includes/parser/Parser.php
@@ -4810,6 +4810,10 @@
48114811
48124812 list( $paramMap, $mwArray ) = $this->getImageParams( $handler );
48134813
 4814+ if ( !$file ) {
 4815+ $this->addTrackingCategory( 'broken-file-category' );
 4816+ }
 4817+
48144818 # Process the input parameters
48154819 $caption = '';
48164820 $params = array( 'frame' => array(), 'handler' => array(),
Index: trunk/phase3/languages/messages/MessagesQqq.php
@@ -260,6 +260,7 @@
261261 See http://test.wikipedia.org/wiki/Category:Test_ko?uselang={{SUBPAGENAME}}, for example.',
262262 'index-category' => 'Name of the category where pages with the <nowiki>__INDEX__</nowiki> behaviour switch are listed. For description of this behaviour switch see [http://www.mediawiki.org/wiki/Help:Magic_words#Behavior_switches mediawiki].',
263263 'noindex-category' => 'Name of the category where pages with the <nowiki>__NOINDEX__</nowiki> behaviour switch are listed. For description of this behaviour switch see [http://www.mediawiki.org/wiki/Help:Magic_words#Behavior_switches mediawiki].',
 264+'broken-file-category' => 'Name of category where pages that embed files that do not exist ("broken images") are listed.',
264265
265266 'linkprefix' => '{{optional}}',
266267 'mainpagetext' => 'Along with {{msg|mainpagedocfooter}}, the text you will see on the Main Page when your wiki is installed.',
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -749,6 +749,7 @@
750750 'listingcontinuesabbrev' => 'cont.',
751751 'index-category' => 'Indexed pages',
752752 'noindex-category' => 'Noindexed pages',
 753+'broken-file-category' => 'Pages with broken file links',
753754
754755 'linkprefix' => '/^(.*?)([a-zA-Z\\x80-\\xff]+)$/sD', # only translate this message to other languages if you have to change it
755756 'mainpagetext' => "'''MediaWiki has been successfully installed.'''",
Index: trunk/phase3/RELEASE-NOTES
@@ -133,6 +133,7 @@
134134 * Special:ListFiles is now transcludable.
135135 * (bug 13879) Special:Emailuser asks for suitable target user if called without.
136136 * (bug 16956) IPTC and XMP metadata now extracted from images
 137+* (bug 23816) A tracking category is now added for any pages with broken images.
137138
138139 === Bug fixes in 1.18 ===
139140 * (bug 23119) WikiError class and subclasses are now marked as deprecated

Sign-offs

UserFlagDate
Happy-meloninspected12:00, 15 May 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r95171Follow-up r86534 - Do not add tracking categories if we're looking at a speci...bawolff18:46, 21 August 2011
r107623(bug 31469) Make sure tracking category messages expand variables like...bawolff06:44, 30 December 2011

Comments

#Comment by Nikerabbit (talk | contribs)   19:49, 20 April 2011

Should it be called missing images/files then?

#Comment by Bawolff (talk | contribs)   20:41, 20 April 2011

It could be, but it doesn't add the category when you just link to a missing file - [[:file:non-existent.jpg]], you actually have to try to include it [[file:non-existent.jpg]] before the cat is added. I personally like broken better, but either works.

#Comment by P858snake (talk | contribs)   01:35, 21 April 2011

Pointless reply so I get followups

#Comment by Brion VIBBER (talk | contribs)   01:01, 15 June 2011

Looks ok.

#Comment by Aaron Schulz (talk | contribs)   04:19, 15 June 2011

Showing up on special:contributions on my wiki. Likely due to broken icon in contribs bar, e.g. "WikiSysop: Subpages · User rights · Edit count · SUL accounts · Global contributions").

#Comment by Bawolff (talk | contribs)   17:42, 15 June 2011

Why would there be a broken icon in the contribs bar of your wiki?

#Comment by Aaron Schulz (talk | contribs)   17:43, 15 June 2011

The bar was imported from MW.org, but absent the file. In any case, the category should only be for pages and should be based on the page content, not UI msgs.

#Comment by Bawolff (talk | contribs)   17:54, 15 June 2011

This is a larger issue with MediaWiki though. If you put __NOINDEX__ or [[category:Foo]] on MediaWiki:Sp-contributions-footer - The relavent categories will appear on special:contributions.

#Comment by Bawolff (talk | contribs)   17:23, 21 August 2011

So it would seem to make sense to disable all categories on special pages (aka things that use $wgOut->addWikiText and friends which as far as I can tell is only special pages).

Proposed fix (this is to the function OutputPage::addWikiTextTitle):

Index: includes/OutputPage.php
===================================================================
--- includes/OutputPage.php	(revision 95155)
+++ includes/OutputPage.php	(working copy)
@@ -1375,6 +1375,9 @@
 
 		$popts->setTidy( $oldTidy );
 
+		# Don't want categories in message pages to affect
+		# special pages and the like.
+		$parserOutput->setCategoryLinks( array() );
 		$this->addParserOutput( $parserOutput );
 
 		wfProfileOut( __METHOD__ );

I'm not 100% sure if that's sane, but seems the best solution to me. Thoughts?

#Comment by Bawolff (talk | contribs)   18:47, 21 August 2011

Instead of doing that, just made the parser check namespace when adding a tracking category in r95171.

resetting to new

Status & tagging log