From 9401ed5bb2465805d3fef979bdd4f80c28daad00 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Tue, 2 May 2006 00:41:30 +0000 Subject: [PATCH] (bug 5782) Allow entries in the bad image list to use canonical namespace names --- RELEASE-NOTES | 1 + includes/Image.php | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b50ecfcade..5b777fff08 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -183,6 +183,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 4876) Add __NEWSECTIONLINK__ magic word to force the "new section" link/tab to show up on specific pages on demand * Bidi-aid on list pages +* (bug 5782) Allow entries in the bad image list to use canonical namespace names == Compatibility == diff --git a/includes/Image.php b/includes/Image.php index 88ffbeb23b..4547a8c480 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1873,18 +1873,19 @@ function wfGetSVGsize( $filename ) { function wfIsBadImage( $name ) { global $wgContLang; static $titleList = false; - if ( $titleList === false ) { + + if( !$titleList ) { + # Build the list now $titleList = array(); - - $lines = explode("\n", wfMsgForContent( 'bad_image_list' )); - foreach ( $lines as $line ) { - if ( preg_match( '/^\*\s*\[{2}:(' . $wgContLang->getNsText( NS_IMAGE ) . ':.*?)\]{2}/', $line, $m ) ) { - $t = Title::newFromText( $m[1] ); - $titleList[$t->getDBkey()] = 1; + $lines = explode( "\n", wfMsgForContent( 'bad_image_list' ) ); + foreach( $lines as $line ) { + if( preg_match( '/^\*\s*\[\[:?(.*?)\]\]/i', $line, $matches ) ) { + $title = Title::newFromText( $matches[1] ); + if( is_object( $title ) && $title->getNamespace() == NS_IMAGE ) + $titleList[ $title->getDBkey() ] = true; } } } - return array_key_exists( $name, $titleList ); } -- 2.20.1