Uploaded image for project: 'Support Team Tools'
  1. Support Team Tools
  2. STT-296

Cannot redeclare recalc_nested_sets()

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Resolution: Fixed
    • Component/s: Support Toolkit
    • Labels:
      None

      Description

      [quote="Oyabun1":1regcjte]Tried most of the tools on a test board running on local host using:
      PHP 5.3.9
      Apache 2.2.21 VC9
      MySQL 5.5.20

      The test board is an automatic update from 3.0.10 to 3.0.11 RC1. (However, the board wasn't broken so there wasn't anything to fix.)

      Run SQL query is throwing an error when trying to run any query

      Fatal error: Cannot redeclare recalc_nested_sets() (previously declared in ...\includes\functions_admin.php:30) in ...\includes\functions_admin.php on line 60

      Lines 30 to 60 of the includes\functions_admin.php

      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))
          {
              <span class="syntaxcomment">// 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++;
       
              <span class="syntaxcomment">// Then we go through any children and update their left/right id's
              recalc_nested_sets($new_id, $pkey, $table, $row[$pkey], $where);
       
              <span class="syntaxcomment">// 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]}");
              }
              $new_id++;
          }
          $db->sql_freeresult($result);
      } 

      Those lines are identical to 3.0.10.

        Attachments

          Activity

            People

            • Assignee:
              Erik Frèrejean Erik Frèrejean
              Reporter:
              Erik Frèrejean Erik Frèrejean
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: