You are here

function coder_upgrade_module_list in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/includes/conversion.inc \coder_upgrade_module_list()

Returns list of contributed modules.

Parameters

null $core: Indicates whether to return core modules regardless of settings variable.

integer $status: Indicates status of modules to return.

Return value

array Array of contributed modules.

3 calls to coder_upgrade_module_list()
coder_upgrade_conversions_prepare in coder_upgrade/includes/conversion.inc
Returns the parameters to submit for module conversion.
coder_upgrade_modules_build in coder_upgrade/includes/conversion.inc
Returns form content for modules tab.
coder_upgrade_theme_build_registry in coder_upgrade/conversions/begin.inc
Builds theme registry for disabled core modules.

File

coder_upgrade/includes/conversion.inc, line 559

Code

function coder_upgrade_module_list($core = NULL, $status = -1) {
  $test = is_null($core) ? variable_get('coder_upgrade_upgrade_core', FALSE) : $core;
  $like = $test ? 'LIKE' : 'NOT LIKE';
  $where = $status == -1 ? '' : 'AND status = :status';

  // Faster to query DB than to rescan files using _system_get_module_data().
  $sql = "SELECT name, filename, type, status, info,\n          REPLACE(filename, CONCAT('/', name, '.', type), '') AS directory\n          FROM {system}\n          WHERE type = 'module'\n          AND filename {$like} 'modules/%'\n          {$where}\n          ORDER BY directory, name";
  $default_value = 0;
  $results = db_query($sql, array(
    ':status' => $status,
  ));
  $rows = array();
  foreach ($results as $module) {
    $info = unserialize($module->info);
    $row = array();
    $row['name'] = $info['name'];
    $row['path'] = dirname($module->filename);

    // $module->filename;
    $row['dir'] = $module->directory;

    // dirname($module->filename);
    //    $row['filename'] = $module->filename; // Add this for later calls to module_list().
    //    $row['status'] = $module->status;
    // TODO Pull files from this table???
    // Would need to change the conversion code to not read the filesystem.
    $rows[$module->name] = $row;
  }
  return $rows;
}