Commit bbce7d63 authored by mikeryan's avatar mikeryan Committed by Dave Reid

Issue #2065559 by mikeryan: Use drupal_static() in...

Issue #2065559 by mikeryan: Use drupal_static() in xmlsitemap_node_get_timestamps() to help prevent excessive memory use when bulk creating/updating nodes.
parent 031bae4f
......@@ -146,7 +146,7 @@ function xmlsitemap_node_form_node_form_alter(array &$form, array &$form_state)
* An array of UNIX timestamp integers.
*/
function xmlsitemap_node_get_timestamps(stdClass $node) {
static $timestamps = array();
$timestamps = &drupal_static(__FUNCTION__, array());
if (!isset($timestamps[$node->nid])) {
$timestamps[$node->nid] = db_query("SELECT nr.timestamp FROM {node_revision} nr WHERE nr.nid = :nid", array(':nid' => $node->nid))->fetchCol();
......
Markdown is supported
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