ported live patches
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 25 Apr 2005 03:30:24 +0000 (03:30 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 25 Apr 2005 03:30:24 +0000 (03:30 +0000)
includes/Database.php
includes/Image.php

index 51104db..4ed8c59 100644 (file)
@@ -289,6 +289,7 @@ class Database {
                        # 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 );
                }
                
@@ -334,6 +335,7 @@ class Database {
                                
                if ( $wgProfiling ) {
                        wfProfileOut( $profName );
+                       wfProfileOut( 'Database::query' );
                }
                return $ret;
        }
index 0c6f06a..5ddc446 100644 (file)
@@ -1518,18 +1518,21 @@ function wfGetSVGsize( $filename ) {
  * 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 );
 }