/** * Load the all-users results into cache * * @param array $ldapConfig * @param int $page * @param optional $proxy * @return string The requested XML string of the page results * @access public * @since 7/30/09 */ function loadAllUsersCache(array $ldapConfig, $page, $proxy = null) { $params = $_GET; $results = loadAllResults($ldapConfig); $count = count($results); $curPage = 0; $i = 0; while ($i < $count) { $i = $i + ALL_USERS_PAGE_SIZE; $params['page'] = $curPage; $pageResults = array_slice($results, $curPage * ALL_USERS_PAGE_SIZE, ALL_USERS_PAGE_SIZE); $pageXml = getResultXml($pageResults, $params, $proxy, $i < $count); if ($page == $curPage) { $requestedPageXml = $pageXml; } $curPage++; } $numPagesCacheKey = getCacheKey(array(), $proxy, 'all_users_pages'); apc_store($numPagesCacheKey, $curPage, RESULT_CACHE_TTL); if (isset($requestedPageXml)) { return $requestedPageXml; } // Return an empty result set. return getResultXml(array(), $params, $proxy); }
ini_set('memory_limit', $minBytes); } if (!isset($_GET['page'])) { $page = 0; } else { $page = intval($_GET['page']); } if ($page < 0) { throw new InvalidArgumentException("'page' must be 0 or greater."); } $xmlString = getAllUsersPageXml($ldapConfig, $page, $proxy); if (SHOW_TIMERS) { $end = microtime(); } } else { $results = loadAllResults($ldapConfig); if (SHOW_TIMERS) { $end = microtime(); } $xmlString = getResultXml($results, $_GET, $proxy); } } if (SHOW_TIMERS) { if (!isset($end)) { $end = microtime(); } list($sm, $ss) = explode(" ", $start); list($em, $es) = explode(" ", $end); $s = $ss + $sm; $e = $es + $em; @header('X-Runtime: ' . ($e - $s));