- Patch #733306 by atchijov, carlos8f: add static caching for drupal_parse_info_file().

merge-requests/26/head
Dries Buytaert 2011-04-10 21:39:14 +02:00
parent c8c0e0b04b
commit 5e1e44c4c0
1 changed files with 11 additions and 5 deletions

View File

@ -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];
}
/**