You are here

function views_system_rebuild_module_data in Views System 8

Same name and namespace in other branches
  1. 7.4 views_system.module \views_system_rebuild_module_data()

Helper function to rebuild module's data.

4 calls to views_system_rebuild_module_data()
views_system_cache_flush in ./views_system.module
Implements hook_cache_flush().
views_system_form_system_modules_alter in ./views_system.module
Implements hook_form_FORM_ID_alter().
views_system_install in ./views_system.install
Implements hook_install().
views_system_modules_installed in ./views_system.module
Implements hook_modules_installed().

File

./views_system.module, line 70
Extends the Views module and provides fields, filter criteria, and sort criteria for Modules/Themes/Theme engines.

Code

function views_system_rebuild_module_data() {
  db_query("DELETE FROM {views_system} WHERE type = 'module' OR type = 'profile'");
  $modules = system_rebuild_module_data();
  foreach ($modules as $module) {
    $data = array();
    $data['filename'] = $module
      ->getFilename();
    $data['core'] = $module->info['core'];
    $data['datestamp'] = !empty($module->info['datestamp']) ? (int) $module->info['datestamp'] : NULL;
    $data['dependencies'] = !empty($module->info['dependencies']) ? serialize($module->info['dependencies']) : '';
    $data['description'] = !empty($module->info['description']) ? $module->info['description'] : '';
    $data['info'] = serialize($module->info);
    $data['label'] = $module->info['name'];
    $data['mtime'] = $module->info['mtime'];
    $data['name'] = $module
      ->getName();
    $data['origin'] = preg_match('/^core\\/(modules|profiles)\\//i', $module
      ->getPathname()) ? 'core' : 'extension';
    $data['package'] = !empty($module->info['package']) ? $module->info['package'] : '';
    $data['pathname'] = $module
      ->getPathname();
    $data['php'] = !empty($module->info['php']) ? $module->info['php'] : '';
    $data['project'] = !empty($module->info['project']) ? $module->info['project'] : '';
    $data['project_status_url'] = !empty($module->info['project_status_url']) ? $module->info['project_status_url'] : '';
    $data['required'] = !empty($module->info['required']) ? (int) $module->info['required'] : 0;
    $data['required_by'] = !empty($module->required_by) ? serialize($module->required_by) : '';
    $data['requires'] = !empty($module->requires) ? serialize($module->requires) : '';
    $data['schema_version'] = $module->schema_version;
    $data['status'] = $module->status;
    $data['type'] = $module
      ->getType();
    $data['version'] = !empty($module->info['version']) ? $module->info['version'] : '';
    $data['visible'] = !empty($module->info['hidden']) ? (int) (!$module->info['hidden']) : 1;
    $data['weight'] = $module->weight;
    db_insert('views_system')
      ->fields($data)
      ->execute();
  }
}