1 update.inc update_module_add_to_system($modules = array())

Adds modules to the system table in a Backdrop core update.

Parameters

$modules: Array of module names.

File

core/includes/update.inc, line 270
Backdrop site update API.

Code

function update_module_add_to_system($modules = array()) {
  // Insert module data, so we can enable the module. Calling a full module
  // list rebuild so early is costly and complex, so we just have a stop-gap.
  $info_defaults = array(
    'dependencies' => array(),
    'description' => '',
    'package' => 'Other',
    'version' => NULL,
    'php' => BACKDROP_MINIMUM_PHP,
    'files' => array(),
    'bootstrap' => 0,
  );
  foreach ($modules as $module) {
    $module_info = backdrop_parse_info_file('core/modules/' . $module . '/' . $module . '.info');
    db_insert('system')
      ->fields(array(
        'filename' => 'core/modules/' . $module . '/' . $module . '.module',
        'name' => $module,
        'type' => 'module',
        'status' => 0,
        'bootstrap' => 0,
        'schema_version' => -1,
        'weight' => 0,
        'info' => serialize($module_info + $info_defaults),
      ))
      ->execute();
  }
}