function _registry_parse_file

7 _registry_parse_file($filename, $contents, $module = '', $weight = 0)

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.

Related topics

2 calls to _registry_parse_file()
RegistryParseFileTestCase::testRegistryParseFile in modules/simpletest/tests/registry.test
_registry_parse_files in includes/
Parse all files that have changed since the registry was last built, and save their function and class listings.


includes/, line 163
This file contains the code registry parser engine.


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) {
        'name' => $name,
        'type' => $matches[1][$key],
        'filename' => $filename,
        'module' => $module,
        'weight' => $weight,
    // 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();