Index: trunk/phase3/includes/CoreParserFunctions.php |
— | — | @@ -224,15 +224,18 @@ |
225 | 225 | static $cache = array(); |
226 | 226 | $category = Category::newFromName( $name ); |
227 | 227 | |
| 228 | + if( !is_object( $category ) ) { |
| 229 | + $cache[$name] = 0; |
| 230 | + return self::formatRaw( 0, $raw ); |
| 231 | + } |
| 232 | + |
228 | 233 | # Normalize name for cache |
229 | 234 | $name = $category->getName(); |
230 | 235 | |
| 236 | + $count = 0; |
231 | 237 | if( isset( $cache[$name] ) ) { |
232 | | - return self::formatRaw( $cache[$name], $raw ); |
233 | | - } |
234 | | - |
235 | | - $count = 0; |
236 | | - if( is_object( $category ) && $parser->incrementExpensiveFunctionCount() ) { |
| 238 | + $count = $cache[$name]; |
| 239 | + } elseif( $parser->incrementExpensiveFunctionCount() ) { |
237 | 240 | $count = $cache[$name] = (int)$category->getPageCount(); |
238 | 241 | } |
239 | 242 | return self::formatRaw( $count, $raw ); |