Commit 72423d61 authored by drumm's avatar drumm
Browse files

Issue #3117465: Manage static caches instead of removing the memory limit

parent f3730715
......@@ -92,13 +92,14 @@ function project_usage_retrieve_metadata() {
$machine_name_id[$bundle] = $fields['field_project_machine_name']['field_id'];
}
if (isset($result['node'])) {
foreach (array_chunk($result['node'], 100) as $projects) {
foreach (array_chunk($result['node'], 200) as $projects) {
foreach ($projects as $project) {
field_attach_load('node', array($project->nid => $project), FIELD_LOAD_CURRENT, array('field_id' => $machine_name_id[$project->type]));
$project_name = $project->field_project_machine_name[LANGUAGE_NONE][0]['value'];
$projnames[$project->nid] = $project_name;
$projnids[$project_name] = $project->nid;
}
drupal_static_reset();
}
}
......@@ -108,13 +109,14 @@ function project_usage_retrieve_metadata() {
->entityCondition('bundle', project_release_release_node_types())
->execute();
if (isset($result['node'])) {
foreach (array_chunk(array_keys($result['node']), 100) as $releases) {
foreach (array_chunk(array_keys($result['node']), 200) as $releases) {
foreach (node_load_multiple($releases, array(), TRUE) as $release) {
$project_name = $projnames[$release->field_release_project[LANGUAGE_NONE][0]['target_id']];
$releasedata[$project_name]['projectname'] = $project_name;
$releasedata[$project_name]['project_nid'] = $release->field_release_project[LANGUAGE_NONE][0]['target_id'];
$releasedata[$project_name][$release->field_release_version[LANGUAGE_NONE][0]['value']]['release_nid'] = $release->nid;
}
drupal_static_reset();
}
}
......@@ -138,7 +140,6 @@ function drush_project_usage_import_usage_stats($week) {
$count_file_path = variable_get('project_usage_count_file_path', '/var/log/updatestats/counts');
}
ini_set('memory_limit', '-1');
$metadata = project_usage_retrieve_metadata();
drush_log(dt('Reading usage counts.'));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment