Index: trunk/admin/category/permcacheupdate.php =================================================================== diff -u -r578 -r677 --- trunk/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 578) +++ trunk/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 677) @@ -207,11 +207,13 @@ $data = $this->Stack->Get(); if ($data === false) { //If Stack is empty $data['current_id'] = 0; + $data['title'] = Array(); $this->Stack->Push($data); } if (!isset($data['queried'])) { + $this->QueryTitle($data); $this->QueryChildren($data); $this->QueryPermissions($data); $data['queried'] = 1; @@ -230,7 +232,8 @@ // if we have more children if (isset($data['children'][$data['current_child']])) { - $next_data = array(); + $next_data = Array(); + $next_data['title'] = $data['title']; $next_data['current_id'] = $data['children'][$data['current_child']]; //next iteration should process child $next_data['perms'] = $data['perms']; //we should copy our permissions to child - inheritance $next_data['perms']->SetCatId($next_data['current_id']); @@ -240,15 +243,29 @@ return true; } else { + $this->UpdateCachedPath($data); $this->Stack->Pop(); //remove ourself from stack if we have finished all the childs (or there are none) // we are getting here if we finished with current level, so check if it's first level - then bail out. return $this->Stack->Count() > 0; } } - + function UpdateCachedPath(&$data) + { + $sql='UPDATE '.GetTablePrefix().'Category SET CachedNavbar="'.addslashes(join('>',$data['title'])) .'" WHERE CategoryId = '.$data['current_id']; + $this->conn->Execute($sql); + } + function QueryTitle(&$data) + { + $sql = sprintf('SELECT Name FROM '.GetTablePrefix().'Category WHERE CategoryId = %s', + $data['current_id']); + $rs = $this->conn->Execute($sql); + + if ($rs && !$rs->EOF) + $data['title'][] = $rs->fields['Name']; + } function QueryChildren(&$data) { - $sql = sprintf('SELECT CategoryId From '.GetTablePrefix().'Category WHERE ParentId = %s', + $sql = sprintf('SELECT CategoryId FROM '.GetTablePrefix().'Category WHERE ParentId = %s', $data['current_id']); $rs = $this->conn->Execute($sql);