Code registry

 drupal_function_exists ($function)
 drupal_autoload_interface ($interface)
 drupal_autoload_class ($class)
 _registry_check_code ($type, $name)
 registry_mark_code ($type, $name, $return=FALSE)
 drupal_rebuild_code_registry ()
 registry_cache_hook_implementations ($hook, $write_to_persistent_cache=FALSE)
 registry_cache_path_files ()
 registry_load_path_files ($return=FALSE)
 registry_get_hook_implementations_cache ()

Functions

 _drupal_rebuild_code_registry ()
 registry_get_parsed_files ()
 _registry_parse_files ($files)
 _registry_parse_file ($filename, $contents)
 _registry_get_resource_name (&$tokens=NULL, $type=NULL)
 _registry_skip_body (&$tokens)

Detailed Description

The code registry engine.

Drupal maintains an internal registry of all functions or classes in the system, allowing it to lazy-load code files as needed (reducing the amount of code that must be parsed on each request). The list of included files is cached per menu callback for subsequent loading by the menu router. This way, a given page request will have all the code it needs but little else, minimizing time spent parsing unneeded code.


Function Documentation

_drupal_rebuild_code_registry (  ) 

drupal_rebuild_code_registry.

Definition at line 25 of file registry.inc.

References _registry_get_resource_name(), _registry_parse_files(), cache_clear_all(), db_query(), file_scan_directory(), module_rebuild_cache(), and registry_get_parsed_files().

Referenced by drupal_rebuild_code_registry().

Here is the call graph for this function:

_registry_check_code ( type,
name 
)

Helper for registry_check_{interface, class}.

Definition at line 1272 of file bootstrap.inc.

References $name, $type, db_query(), db_result(), and registry_mark_code().

Referenced by drupal_autoload_class(), and drupal_autoload_interface().

Here is the call graph for this function:

_registry_get_resource_name ( &$  tokens = NULL,
type = NULL 
)

Derive the name of the next resource in the token stream.

When called without arguments, it resets its static cache.

Parameters:
$tokens The collection of tokens for the current file being parsed.
$type The human-readable token name, either: "function", "class", or "interface".
Returns:
The name of the resource, or FALSE if the resource has already been processed.

Definition at line 136 of file registry.inc.

References $type.

Referenced by _drupal_rebuild_code_registry(), and _registry_parse_file().

_registry_parse_file ( filename,
contents 
)

Parse a file and save its function and class listings.

Parameters:
$filename Name of the file we are going to parse.
$contents Contents of the file we are going to parse as a string.

Definition at line 106 of file registry.inc.

References $type, _registry_get_resource_name(), _registry_skip_body(), and db_query().

Referenced by _registry_parse_files().

Here is the call graph for this function:

_registry_parse_files ( files  ) 

Parse all files that have changed since the registry was last built, and save their function and class listings.

Parameters:
$files The list of files to check and parse.

Definition at line 77 of file registry.inc.

References _registry_parse_file(), and db_query().

Referenced by _drupal_rebuild_code_registry().

Here is the call graph for this function:

_registry_skip_body ( &$  tokens  ) 

Skip the body of a code block, as defined by { and }.

This function assumes that the body starts at the next instance of { from the current position.

Parameters:
$tokens 

Definition at line 170 of file registry.inc.

Referenced by _registry_parse_file().

drupal_autoload_class ( class  ) 

Confirm that a class is available.

This function parallels drupal_function_exists(), but is rarely called directly. Instead, it is registered as an spl_autoload() handler, and PHP calls it for us when necessary.

Parameters:
$class The name of the class to check or load.
Returns:
TRUE if the class is currently available, FALSE otherwise.

Definition at line 1265 of file bootstrap.inc.

References _registry_check_code().

Here is the call graph for this function:

drupal_autoload_interface ( interface  ) 

Confirm that an interface is available.

This function parallels drupal_function_exists(), but is rarely called directly. Instead, it is registered as an spl_autoload() handler, and PHP calls it for us when necessary.

Parameters:
$interface The name of the interface to check or load.
Returns:
TRUE if the interface is currently available, FALSE otherwise.

Definition at line 1249 of file bootstrap.inc.

References _registry_check_code().

Here is the call graph for this function:

drupal_function_exists ( function  ) 

Confirm that a function is available.

If the function is already available, this function does nothing. If the function is not available, it tries to load the file where the function lives. If the file is not available, it returns false, so that it can be used as a drop-in replacement for function_exists().

Parameters:
$function The name of the function to check or load.
Returns:
TRUE if the function is now available, FALSE otherwise.

Definition at line 1207 of file bootstrap.inc.

References db_query(), db_result(), and registry_mark_code().

Referenced by _form_builder_handle_input_element(), _form_validate(), _init_theme(), _menu_router_build(), drupal_mail(), drupal_prepare_form(), drupal_render(), drupal_retrieve_form(), form_execute_handlers(), menu_execute_active_handler(), module_enable(), module_hook(), module_invoke_all(), theme(), and xmlrpc_server_call().

Here is the call graph for this function:

drupal_rebuild_code_registry (  ) 

Rescan all enabled modules and rebuild the registry.

Rescans all code in modules or includes directory, storing a mapping of each function, file, and hook implementation in the database.

Definition at line 1314 of file bootstrap.inc.

References _drupal_rebuild_code_registry().

Referenced by drupal_flush_all_caches(), module_disable(), and module_enable().

Here is the call graph for this function:

registry_cache_hook_implementations ( hook,
write_to_persistent_cache = FALSE 
)

Save hook implementations cache.

Parameters:
$hook Array with the hook name and list of modules that implement it.
$write_to_persistent_cache Whether to write to the persistent cache.

Definition at line 1327 of file bootstrap.inc.

References cache_set(), and registry_get_hook_implementations_cache().

Referenced by drupal_page_footer(), and module_implements().

Here is the call graph for this function:

registry_cache_path_files (  ) 

Save the files required by the registry for this path.

Definition at line 1347 of file bootstrap.inc.

References $row, $type, cache_set(), db_fetch_object(), db_placeholders(), db_query(), menu_get_item(), registry_load_path_files(), and registry_mark_code().

Referenced by drupal_page_footer().

Here is the call graph for this function:

registry_get_hook_implementations_cache (  ) 

registry_get_hook_implementations_cache

Definition at line 1395 of file bootstrap.inc.

References cache_get().

Referenced by module_implements(), and registry_cache_hook_implementations().

Here is the call graph for this function:

registry_get_parsed_files (  ) 

Return the list of files in registry_file

Definition at line 62 of file registry.inc.

References db_fetch_array(), and db_query().

Referenced by _drupal_rebuild_code_registry().

Here is the call graph for this function:

registry_load_path_files ( return = FALSE  ) 

registry_load_path_files

Definition at line 1376 of file bootstrap.inc.

References $return, cache_get(), and menu_get_item().

Referenced by menu_execute_active_handler(), and registry_cache_path_files().

Here is the call graph for this function:

registry_mark_code ( type,
name,
return = FALSE 
)

Collect the resources used for this request.

Parameters:
$type The type of resource.
$name The name of the resource.
$return Boolean flag to indicate whether to return the resources.

Definition at line 1291 of file bootstrap.inc.

References $name, $return, and $type.

Referenced by _registry_check_code(), drupal_function_exists(), and registry_cache_path_files().


Generated on Mon Jun 2 15:08:57 2008 for SimpleTest by  1.5.5