_registry_parse_file($filename, $contents, $module = '', $weight = 0)
drupal/includes/registry.inc, line 166
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.
$module (optional) Name of the module this file belongs to.
$weight (optional) Weight of the module.
| Name | Description |
|---|---|
| Code registry | The code registry engine. |
function _registry_parse_file($filename, $contents, $module = '', $weight = 0) {
if (preg_match_all('/^\s*(?:abstract)?\s*(class|interface)\s+([a-zA-Z0-9_]+)/m', $contents, $matches)) {
$query = db_insert('registry')->fields(array('name', 'type', 'filename', 'module', 'weight'));
foreach ($matches[2] as $key => $name) {
$query->values(array(
'name' => $name,
'type' => $matches[1][$key],
'filename' => $filename,
'module' => $module,
'weight' => $weight,
));
}
$query->execute();
}
}