public function updateAllNodesPaths()
{
$types = $this->Taxonomy->Vocabulary->Type->find('list', array('fields' => array('Type.id', 'Type.alias')));
$typesAlias = array_values($types);
$idField = $this->escapeField();
$batch = 30;
$options = array('order' => $idField, 'conditions' => array($this->alias . '.type' => $typesAlias), 'fields' => array($this->alias . '.id', $this->alias . '.slug', $this->alias . '.type', $this->alias . '.path'), 'recursive' => '-1', 'limit' => $batch);
$results = array();
while ($nodes = $this->find('all', $options)) {
foreach ($nodes as &$node) {
$node[$this->alias]['path'] = $this->_getNodeRelativePath($node);
}
$result = $this->saveMany($nodes, array('fieldList' => array('path')));
if ($result === false) {
$this->log('updateAllNodesPath batch failed:');
$this->log($this->validationErrors);
return false;
}
$results[] = $result;
$options['conditions'][$idField . ' >'] = $node[$this->alias]['id'];
if (count($nodes) < $batch) {
break;
}
}
return $this->saveMany($nodes, array('fieldList' => array('path')));
}