function _registry_parse_file
_registry_parse_file($filename, $contents, $module = '', $weight = 0)
Parse a file and save its interface 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
File
- includes/registry.inc, line 166
- This file contains the code registry parser engine.
Code
function _registry_parse_file($filename, $contents, $module = '', $weight = 0) { if (preg_match_all('/^\s*(?:abstract|final)?\s*(class|interface|trait)\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(); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!registry.inc/function/_registry_parse_file/7.x