leviatan21 escribió:En lugar de adjuntar el archivo, revisalo que no tenga dos veces la función recalc_nested_sets
La tiene dos veces, pero ''no contiene'' lo mismo
por la linea 30
Código: Seleccionar todo
function recalc_nested_sets(&$new_id, $pkey, $table, $parent_id = 0, $where = array())
y en la 50
Código: Seleccionar todo
recalc_nested_sets($new_id, $pkey, $table, $row[$pkey], $where);
Como ves, no tiene lo mismo, te pongo desde la linea 25 a la 55 para que veas mas o menos el codigo
Código: Seleccionar todo
* @param int $parent_id parent_id of the current set (default = 0)
* @param array $where contains strings to compare closer on the where statement (additional)
*
* @author EXreaction
*/
function recalc_nested_sets(&$new_id, $pkey, $table, $parent_id = 0, $where = array())
{
global $db;
$sql = 'SELECT *
FROM ' . $table . '
WHERE parent_id = ' . (int) $parent_id .
((!empty($where)) ? ' AND ' . implode(' AND ', $where) : '') . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// First we update the left_id for this module
if ($row['left_id'] != $new_id)
{
$db->sql_query('UPDATE ' . $table . ' SET ' . $db->sql_build_array('UPDATE', array('left_id' => $new_id)) . " WHERE $pkey = {$row[$pkey]}");
}
$new_id++;
// Then we go through any children and update their left/right id's
recalc_nested_sets($new_id, $pkey, $table, $row[$pkey], $where);
// Then we come back and update the right_id for this module
if ($row['right_id'] != $new_id)
{
$db->sql_query('UPDATE ' . $table . ' SET ' . $db->sql_build_array('UPDATE', array('right_id' => $new_id)) . " WHERE $pkey = {$row[$pkey]}");
Cual de las dos ''sobra'' ?¿