A little perf and memory enhancement when building category tree
This commit is contained in:
parent
3c6f122a81
commit
9876e37309
@ -1213,7 +1213,8 @@ class Categorie extends CommonObject
|
||||
//print 'Result for id_categ='.$id_categ.' : '.$this->cats[$id_categ]['fullpath'].'<br>'."\n";
|
||||
|
||||
// We count number of _ to have level
|
||||
$this->cats[$id_categ]['level'] = dol_strlen(preg_replace('/[^_]/i', '', $this->cats[$id_categ]['fullpath']));
|
||||
$nbunderscore = substr_count($this->cats[$id_categ]['fullpath'], '_');
|
||||
$this->cats[$id_categ]['level'] = ($nbunderscore ? $nbunderscore : null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user