diff --git a/VERSION.json b/VERSION.json index 56601c8f9..41e701d7d 100644 --- a/VERSION.json +++ b/VERSION.json @@ -1 +1 @@ -{"major":2, "minor":3, "hotfix":131} \ No newline at end of file +{"major":2, "minor":3, "hotfix":133} \ No newline at end of file diff --git a/app/Console/Command/AdminShell.php b/app/Console/Command/AdminShell.php index 9a145f092..6e844c761 100644 --- a/app/Console/Command/AdminShell.php +++ b/app/Console/Command/AdminShell.php @@ -11,16 +11,19 @@ class AdminShell extends AppShell $this->loadModel('Correlation'); $this->Correlation->deleteAll(array('id !=' => ''), false); $this->loadModel('Attribute'); - $fields = array('Attribute.id', 'Attribute.event_id', 'Attribute.distribution', 'Attribute.cluster', 'Event.date', 'Event.org'); - // get all attributes.. - $attributes = $this->Attribute->find('all', array('recursive' => -1)); - // for all attributes.. - $total = count($attributes); - foreach ($attributes as $k => $attribute) { - if ($k > 0 && $k % 1000 == 0) { - $this->Job->saveField('progress', $k/$total*100); + $attributeIDs = array_keys($this->Attribute->find('list')); + $total = count($attributeIDs); + $start = 0; + $continue = true; + while ($continue) { + + $attributes = $this->Attribute->find('all', array('recursive' => -1, 'conditions' => array('AND' => array('Event.id' > $start, 'Event.id' <= ($start + 1000))))); + foreach ($attributes as $k => $attribute) { + $this->Attribute->__afterSaveCorrelation($attribute['Attribute']); } - $this->Attribute->__afterSaveCorrelation($attribute['Attribute']); + $this->Job->saveField('progress', $k/$total*100); + $start += 1000; + if ($start > $total) $continue = false; } $this->Job->saveField('progress', 100); $this->Job->saveField('message', 'Job done.');