# generalizeSQL will probably cut down the query to reasonable
# logging size most of the time. The substr is really just a sanity check.
$profName = 'query: ' . substr( Database::generalizeSQL( $sql ), 0, 255 );
+ wfProfileIn( 'Database::query' );
wfProfileIn( $profName );
}
if ( $wgProfiling ) {
wfProfileOut( $profName );
+ wfProfileOut( 'Database::query' );
}
return $ret;
}
* Is an image on the bad image list?
*/
function wfIsBadImage( $name ) {
- global $wgLang;
-
- $lines = explode("\n", wfMsgForContent( 'bad_image_list' ));
- foreach ( $lines as $line ) {
- if ( preg_match( '/^\*\s*\[\[:(' . $wgLang->getNsText( NS_IMAGE ) . ':.*(?=]]))\]\]/', $line, $m ) ) {
- $t = Title::newFromText( $m[1] );
- if ( $t->getDBkey() == $name ) {
- return true;
+ global $wgContLang;
+ static $titleList = false;
+ if ( $titleList === false ) {
+ $titleList = array();
+
+ $lines = explode("\n", wfMsgForContent( 'bad_image_list' ));
+ foreach ( $lines as $line ) {
+ if ( preg_match( '/^\*\s*\[\[:(' . $wgContLang->getNsText( NS_IMAGE ) . ':[^\]]*)\]\]/', $line, $m ) ) {
+ $t = Title::newFromText( $m[1] );
+ $titleList[$t->getDBkey()] = 1;
}
}
}
- return false;
+
+ return array_key_exists( $name, $titleList );
}