public function GetResults() { // Get the library owner ID $userID = NULL; if (!get_library_owner($userID)) { return array(); } log_message('debug', sprintf('[inventory_lib_owner] library owner is %s', $userID)); $results[] = array('agent_id' => $userID); return $results; }
public function GetResults() { // Get the library owner ID $userID = NULL; if (!get_library_owner($userID)) { log_message('warn', '[inventory_lib_root] no library owner found'); return array(); } log_message('debug', sprintf('[inventory_lib_root] library owner is %s', $userID)); // Get the root folder ID $rootFolderID = NULL; if (!get_library_root_folder($userID, $rootFolderID)) { log_message('warn', '[inventory_lib_root] no library root found'); return array(); } log_message('debug', sprintf('[inventory_lib_root] library root is %s', $rootFolderID)); $results[] = array('folder_id' => $rootFolderID); return $results; }
public function GetResults() { $mimes =& get_mimes(); // Get the library owner ID $userID = NULL; if (!get_library_owner($userID)) { log_message('warn', '[inventory_skel_lib] failed to get library owner'); return array(); } else { // Get the root folder ID $rootFolderID = $userID; if (!get_library_root_folder($userID, $rootFolderID)) { log_message('warn', '[inventory_skel_lib] failed to get library root'); return array(); } // Get the items from the inventory folder $items = NULL; if (!get_inventory_items($userID, $rootFolderID, 0, $items)) { log_message('warn', '[inventory_skel_lib] failed to get library contents'); return array(); } // Build the output folder structure $folders = array(); foreach ($items as $item) { $type = isset($mimes[$item['ContentType']]) ? $mimes[$item['ContentType']] : -1; $parentid = $item['ParentID']; $folderid = $item['ID']; $foldername = $item['Name']; if ($folderid == $rootFolderID) { $parentid = '00000000-0000-0000-0000-000000000000'; } $folders[] = array('folder_id' => $folderid, 'name' => $foldername, 'parent_id' => $parentid, 'version' => (int) $item['Version'], 'type_default' => (int) $type); } log_message('debug', sprintf('[inventory_skel_lib] %d folders from %s owned by %s', count($folders), $rootFolderID, $userID)); return $folders; } }