summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-12-29 04:25:10 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-12-29 04:25:10 +0000
commitc671e6b9dd3ffa11c032f3772c5fda05e9206f27 (patch)
tree04b39588942743f8e61af23bd9b5e3fe3284f44e
parent7e1fda54034a1ec5b1b90f564f7819a2fa9a6bcc (diff)
downloaddrupal-c671e6b9dd3ffa11c032f3772c5fda05e9206f27.tar.gz
drupal-c671e6b9dd3ffa11c032f3772c5fda05e9206f27.zip
#669554 by dww: Reduce RAM bloat: only save attributes from .info we care about in Update module.
-rw-r--r--modules/update/update.compare.inc30
1 files changed, 29 insertions, 1 deletions
diff --git a/modules/update/update.compare.inc b/modules/update/update.compare.inc
index 337d5eb6e7f..83bed20bc80 100644
--- a/modules/update/update.compare.inc
+++ b/modules/update/update.compare.inc
@@ -174,7 +174,9 @@ function _update_process_info_list(&$projects, $list, $project_type, $status) {
// project can have multiple modules or themes.
$projects[$project_name] = array(
'name' => $project_name,
- 'info' => $file->info,
+ // Only save attributes from the .info file we care about so we do not
+ // bloat our RAM usage needlessly.
+ 'info' => update_filter_project_info($file->info),
'datestamp' => $file->info['datestamp'],
'includes' => array($file->name => $file->info['name']),
'project_type' => $project_display_type,
@@ -740,3 +742,29 @@ function update_project_cache($cid) {
}
return $projects;
}
+
+/**
+ * Filter the project .info data to only save attributes we need.
+ *
+ * @param array $info
+ * Array of .info file data as returned by drupal_parse_info_file().
+ *
+ * @return
+ * Array of .info file data we need for the Update manager.
+ *
+ * @see _update_process_info_list()
+ */
+function update_filter_project_info($info) {
+ $whitelist = array(
+ '_info_file_ctime',
+ 'datestamp',
+ 'hidden',
+ 'major',
+ 'name',
+ 'package',
+ 'project',
+ 'project status url',
+ 'version',
+ );
+ return array_intersect_key($info, drupal_map_assoc($whitelist));
+}