From 5e1e44c4c03e6a305c01a71ed835a7c09dc577ee Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 10 Apr 2011 21:39:14 +0200 Subject: - Patch #733306 by atchijov, carlos8f: add static caching for drupal_parse_info_file(). --- includes/common.inc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index 0a3ed73ae..5f56d4413 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6918,12 +6918,18 @@ function drupal_write_record($table, &$record, $primary_keys = array()) { * @see drupal_parse_info_format() */ function drupal_parse_info_file($filename) { - if (!file_exists($filename)) { - return array(); - } + $info = &drupal_static(__FUNCTION__, array()); - $data = file_get_contents($filename); - return drupal_parse_info_format($data); + if (!isset($info[$filename])) { + if (!file_exists($filename)) { + $info[$filename] = array(); + } + else { + $data = file_get_contents($filename); + $info[$filename] = drupal_parse_info_format($data); + } + } + return $info[$filename]; } /** -- cgit v1.2.3