7.x field.module field_sync_field_status()

Refreshes the 'active' and 'storage_active' columns for fields.

Related topics

4 calls to field_sync_field_status()
field_cron in modules/field/field.module
Implements hook_cron().
field_flush_caches in modules/field/field.module
Implements hook_flush_caches().
field_modules_disabled in modules/field/field.module
Implements hook_modules_disabled().
field_modules_enabled in modules/field/field.module
Implements hook_modules_enabled().

File

modules/field/field.module, line 427
Attach custom data fields to Drupal entities.

Code

function field_sync_field_status() {
  // Refresh the 'active' and 'storage_active' columns according to the current
  // set of enabled modules.
  $modules = module_list();
  foreach ($modules as $module_name) {
    field_associate_fields($module_name);
  }
  db_update('field_config')
    ->fields(array('active' => 0))
    ->condition('module', $modules, 'NOT IN')
    ->execute();
  db_update('field_config')
    ->fields(array('storage_active' => 0))
    ->condition('storage_module', $modules, 'NOT IN')
    ->execute();
}