4.6.x system.module system_theme_data()
4.7.x system.module system_theme_data()
5.x system.module system_theme_data()
6.x system.module system_theme_data()

Collect data about all currently available themes.

Return value

Array of all available themes and their data.

7 calls to system_theme_data()
system_admin_theme_settings in modules/system/system.admin.inc
Form builder; This function allows selection of the theme to show in administration sections.
system_install in modules/system/system.install
Implementation of hook_install().
system_themes_form in modules/system/system.admin.inc
Menu callback; displays a listing of all themes.
system_theme_settings in modules/system/system.admin.inc
Form builder; display theme configuration for entire site and individual themes.
system_update_6008 in modules/system/system.install
Add info files to themes. The info and owner columns are added by update_fix_d6_requirements() in update.php to avoid a large number of error messages from update.php. All we need to do here is copy description to owner and then drop description.

... See full list


modules/system/system.module, line 807
Configuration system that lets administrators modify the workings of the site.


function system_theme_data() {
  $write_database = TRUE;

  // If lock not acquired, return $files data without writing to database.
  if (!lock_acquire('system_theme_data')) {
    $write_database = FALSE;

    // Wait for the parallel thread to be done so we are more likely
    // to get updated and consistent data.

  // Scan the installation theme .info files and their engines.
  $themes = _system_theme_data();
  foreach ($themes as $key => $theme) {
    if (!isset($theme->owner)) {
      $themes[$key]->owner = '';

  // Extract current files from database.
  system_get_files_database($themes, 'theme');

  // If lock not acquired, return $themes data without writing to database.
  if ($write_database) {
    $filenames = array();
    foreach ($themes as $theme) {

      // Record the filename of each theme that was found.
      $filenames[] = $theme->filename;

      // Existing themes will always have $theme->status set, since it's a
      // property that is only stored in the database.
      if (isset($theme->status)) {
        db_query("UPDATE {system} SET owner = '%s', info = '%s', filename = '%s' WHERE name = '%s' AND type = '%s'", $theme->owner, serialize($theme->info), $theme->filename, $theme->name, 'theme');
      else {
        $theme->status = $theme->name == variable_get('theme_default', 'garland');
        db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, $theme->status, 0, 0);

    // Delete from the system table any themes missing from the file system.
    if ($filenames) {
      db_query("DELETE FROM {system} WHERE type = 'theme' AND filename NOT IN (" . db_placeholders($filenames, 'varchar') . ")", $filenames);
  return $themes;


malc0mn’s picture

Renamed to system_rebuild_theme_data() in D7