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) |
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.
_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().
_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().
_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.
$tokens | The collection of tokens for the current file being parsed. | |
$type | The human-readable token name, either: "function", "class", or "interface". |
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.
$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().
_registry_parse_files | ( | $ | files | ) |
Parse all files that have changed since the registry was last built, and save their function and class listings.
$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().
_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.
$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.
$class | The name of the class to check or load. |
Definition at line 1265 of file bootstrap.inc.
References _registry_check_code().
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.
$interface | The name of the interface to check or load. |
Definition at line 1249 of file bootstrap.inc.
References _registry_check_code().
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().
$function | The name of the function to check or load. |
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().
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().
registry_cache_hook_implementations | ( | $ | hook, | |
$ | write_to_persistent_cache = FALSE | |||
) |
Save hook implementations cache.
$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().
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().
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().
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().
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().
registry_mark_code | ( | $ | type, | |
$ | name, | |||
$ | return = FALSE | |||
) |
Collect the resources used for this request.
$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().