summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-04-10 21:39:14 +0200
committerDries Buytaert <dries@buytaert.net>2011-04-10 21:39:14 +0200
commit5e1e44c4c03e6a305c01a71ed835a7c09dc577ee (patch)
treec12b042fe265ed6e521d6f9fd4b417c0083cff4a /includes
parentc8c0e0b04b00a7f90fc98d1cac3dfa55088401cf (diff)
downloadbrdo-5e1e44c4c03e6a305c01a71ed835a7c09dc577ee.tar.gz
brdo-5e1e44c4c03e6a305c01a71ed835a7c09dc577ee.tar.bz2
- Patch #733306 by atchijov, carlos8f: add static caching for drupal_parse_info_file().
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc16
1 files changed, 11 insertions, 5 deletions
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];
}
/**