countItems($key); } public function reindex() { global $pages; $db = $pages->getDB($onlyKeys=false); $authorsIndex = array(); foreach ($db as $pageKey=>$pageFields) { if ($pageFields['type'] == "article" && $pageFields['state'] == "published") { $authorName = $pageFields['username']; if (isset($authorsIndex[$authorName])) { array_push($authorsIndex[$authorName]['list'], $pageKey); } else { $user = new User($pageFields['username']); $authorsIndex[$authorName]['name'] = $user->displayName(); $authorsIndex[$authorName]['list'] = array($pageKey); } } } $this->db = $authorsIndex; $this->sortAlphanumeric(); return $this->save(); } }