function _registry_parse_file
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.
$module: (optional) Name of the module this file belongs to.
$weight: (optional) Weight of the module.
Related topics
2 calls to _registry_parse_file()
- RegistryParseFileTestCase::testRegistryParseFile in drupal-7.x/
modules/ simpletest/ tests/ registry.test - testRegistryParseFile
- _registry_parse_files in drupal-7.x/
includes/ registry.inc - Parse all files that have changed since the registry was last built, and save their function and class listings.
Archivo
- drupal-7.x/
includes/ registry.inc, line 163 - This file contains the code registry parser engine.
Código
function _registry_parse_file($filename, $contents, $module = '', $weight = 0) {
if (preg_match_all('/^\s*(?:abstract|final)?\s*(class|interface)\s+([a-zA-Z0-9_]+)/m', $contents, $matches)) {
foreach ($matches[2] as $key => $name) {
db_merge('registry')->key(array(
'name' => $name,
'type' => $matches[1][$key],
))->fields(array(
'filename' => $filename,
'module' => $module,
'weight' => $weight,
))->execute();
}
// Delete any resources for this file where the name is not in the list
// we just merged in.
db_delete('registry')->condition('filename', $filename)->condition('name', $matches[2], 'NOT IN')->execute();
}
}