$depth) { return; } // Collect menu items' urls. $expire_urls = array(); if ($links = _menu_build_tree($menu_link['menu_name'], array('max_depth' => $depth))) { $expire_urls = $this->get_urls_from_menu_tree($links['tree']); } // Flush page cache for expired urls. ExpireAPI::executeExpiration(array_unique($expire_urls), 'menu_link', $menu_link); } /** * Fetches an internal urls from a menu items tree. */ private function get_urls_from_menu_tree($tree) { $links = array(); foreach ($tree as $item) { if (empty($item['link']['external']) || $item['link']['link_path'] == '') { $links[] = $item['link']['link_path']; } if (!empty($item['below'])) { $links = array_merge($links, $this->get_urls_from_menu_tree($item['below'])); } } return $links; } }