From 89e89e69b9be08386134c2548e883b604d808275 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Tue, 10 Jan 2006 17:56:59 +0000 Subject: [PATCH] count ( a ) , count ( a,b) , count (a,b,c) -> count++, faster smoother!!! --- includes/Title.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/Title.php b/includes/Title.php index 4649a4ae99..f79edbbcc5 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 ); -- 2.20.1