/** * Entry point for Ajax, registered in $wgAjaxExportList. * The $enc parameter determins how the $options is decoded into a PHP array. * If $enc is not given, '' is asumed, which simulates the old call interface, * namely, only providing the mode name or number. * This loads CategoryTreeFunctions.php and calls CategoryTree::ajax() */ function efCategoryTreeAjaxWrapper($category, $options = array(), $enc = '') { global $wgCategoryTreeHTTPCache, $wgSquidMaxage, $wgUseSquid; if (is_string($options)) { $options = CategoryTree::decodeOptions($options, $enc); } $depth = isset($options['depth']) ? (int) $options['depth'] : 1; $ct = new CategoryTree($options, true); $depth = efCategoryTreeCapDepth($ct->getOption('mode'), $depth); $response = $ct->ajax($category, $depth); if ($wgCategoryTreeHTTPCache && $wgSquidMaxage && $wgUseSquid) { $response->setCacheDuration($wgSquidMaxage); $response->setVary('Accept-Encoding, Cookie'); # cache for anons only # TODO: purge the squid cache when a category page is invalidated } return $response; }
/** * Entry point for Ajax, registered in $wgAjaxExportList. * This loads CategoryTreeFunctions.php and calls CategoryTree::ajax() */ function efCategoryTreeAjaxWrapper($category, $mode) { global $wgCategoryTreeHTTPCache, $wgSquidMaxAge, $wgUseSquid; $ct = new CategoryTree(); $response = $ct->ajax($category, $mode); //FIXME: would need to pass on depth parameter here. if ($wgCategoryTreeHTTPCache && $wgSquidMaxAge && $wgUseSquid) { $response->setCacheDuration($wgSquidMaxAge); $response->setVary('Accept-Encoding, Cookie'); #cache for anons only #TODO: purge the squid cache when a category page is invalidated } return $response; }