X-ray's initial way of showing hooks called was to pull the data from Drupal's cache. Here is the original version of X-ray module's hook invocation / implementation page. The code loaded the information directly from one of Drupal's cache tables.
<?php
/**
* Table of available hooks and the modules implementing them, if any.
*/
function xray_hook_implementations_page() {
$build = array();
$build['intro'] = array(
'#markup' => t("This table shows Drupal hooks present in your site's code and their implementing modules. <em>Note: Only hook invocations involving <a href="@module-implements">module_implements()</a>, which is used by <a href="@module-invoke-all">module_invoke_all()</a> but not by <a href="@module-invoke">module_invoke()</a> for example, are captured here.</em> A list of all properly documented hooks in Drupal core (marked by <tt>@addtogroup hooks</tt> in code or api.php files) is online at <a href="@module-inc-hooks">Drupal API Hooks page</a>.",
array('@module-implements' => '', '@module-invoke-all' => '', '@module-invoke' => '', '@module-inc-hooks' => 'http://api.drupal.org/api/drupal/includes--module.inc/group/hooks/7'))
);
debug(cache_get('hook_info', 'cache_bootstrap'));
// @TODO - fix - foreach ->data throws an error if run immediately after cache clear.
$implementations = cache_get('module_implements', 'cache_bootstrap');
$header = array(t('Hook'), t('Implementing modules'));
$rows = array();
foreach ($implementations->data as $hook => $keys_modules) {
if (empty($keys_modules)) {
$modules_text = t('<em>None</em>');
}
else {
$modules = array_keys($keys_modules);
$modules_text = theme('item_list', array('items' => $modules));
}
$rows[] = array($hook, $modules_text);
}
$build['hook_table'] = array(
'#theme' => 'table__xray__hook_implementations',
'#header' => $header,
'#rows' => $rows,
'#attributes' => array('id' => 'xray-hook-implementations'),
);
// Return the renderable array that we've built for the page.
return $build;
}
?>