count ( a ) , count ( a,b) , count (a,b,c) -> count++, faster smoother!!!
authorDomas Mituzas <midom@users.mediawiki.org>
Tue, 10 Jan 2006 17:56:59 +0000 (17:56 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Tue, 10 Jan 2006 17:56:59 +0000 (17:56 +0000)
includes/Title.php

index 4649a4a..f79edbb 100644 (file)
@@ -135,12 +135,15 @@ class Title {
                $t->mDbkeyform = str_replace( ' ', '_', $filteredText );
                $t->mDefaultNamespace = $defaultNamespace;
 
+               static $cachedcount = 0 ;
                if( $t->secureAndSplit() ) {
                        if( $defaultNamespace == NS_MAIN ) {
-                               if( count( $wgTitleCache ) >= MW_TITLECACHE_MAX ) {
+                               if( $cachedcount >= MW_TITLECACHE_MAX ) {
                                        # Avoid memory leaks on mass operations...
                                        $wgTitleCache = array();
+                                       $cachedcount=0;
                                }
+                               $cachedcount++;
                                $wgTitleCache[$text] =& $t;
                        }
                        wfProfileOut( $fname );