cvs diff: Diffing modules/update
Index: modules/update/update.compare.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.compare.inc,v
retrieving revision 1.22
diff -u -p -r1.22 update.compare.inc
--- modules/update/update.compare.inc	6 Jun 2009 16:05:28 -0000	1.22
+++ modules/update/update.compare.inc	11 Jun 2009 08:17:47 -0000
@@ -51,54 +51,92 @@ function update_get_projects() {
  * Populate an array of project data.
  */
 function _update_process_info_list(&$projects, $list, $project_type) {
-  foreach ($list as $file) {
-    if (empty($file->status)) {
-      // Skip disabled modules or themes.
-      continue;
+  // For theme projects, we also need to find base theme projects.
+  $project_subtypes[] = $project_type;
+  if ($project_type == 'theme') {
+    $project_subtypes[] = 'base_theme';
+    $base_themes = array();
+  }
+  foreach ($project_subtypes AS $project_subtype) {
+    // Determine the full list of base themes for the enabled themes. We also
+    // store a list of sub-themes for each base theme.
+    if ($project_subtype == 'base_theme') {
+      foreach ($base_themes AS $theme) {
+        if (!empty($list[$theme]->info['base theme'])) {
+          $base_theme = $list[$theme]->info['base theme'];
+          // Add parent theme to the end of the array we are currently looping over.
+          $base_themes[$base_theme] = $base_theme;
+          // Add list of sub-themes to the base theme.
+          if (empty($list[$base_theme]->subthemes)) {
+            $list[$base_theme]->subthemes = $list[$theme]->subthemes;
+          }
+          else {
+            $list[$base_theme]->subthemes = array_merge($list[$base_theme]->subthemes, $list[$theme]->subthemes);
+          }
+        }
+      }
     }
+    foreach ($list as $file) {
+      if (empty($file->status) && !isset($file->subthemes)) {
+        // Unless this is a base theme with an enabled sub-theme, skip disabled modules or themes.
+        continue;
+      }
 
-    // Skip if the .info file is broken.
-    if (empty($file->info)) {
-      continue;
-    }
+      // Save the list of parent themes for enabled themes.
+      if ($project_subtype == 'theme' && !empty($file->info['base theme'])) {
+        $base_theme = $file->info['base theme'];
+        // Build a partial list of base themes. The full list is built above.
+        $base_themes[$base_theme] = $base_theme;
+        // Store a list of sub-themes for each base theme.
+        $list[$base_theme]->subthemes[$file->name] = $file->info['name'];
+      }
 
-    // If the .info doesn't define the 'project', try to figure it out.
-    if (!isset($file->info['project'])) {
-      $file->info['project'] = update_get_project_name($file);
-    }
+      // Skip if the .info file is broken.
+      if (empty($file->info)) {
+        continue;
+      }
 
-    // If we still don't know the 'project', give up.
-    if (empty($file->info['project'])) {
-      continue;
-    }
+      // If the .info doesn't define the 'project', try to figure it out.
+      if (!isset($file->info['project'])) {
+        $file->info['project'] = update_get_project_name($file);
+      }
 
-    // If we don't already know it, grab the change time on the .info file
-    // itself. Note: we need to use the ctime, not the mtime (modification
-    // time) since many (all?) tar implementations will go out of their way to
-    // set the mtime on the files it creates to the timestamps recorded in the
-    // tarball. We want to see the last time the file was changed on disk,
-    // which is left alone by tar and correctly set to the time the .info file
-    // was unpacked.
-    if (!isset($file->info['_info_file_ctime'])) {
-      $info_filename = dirname($file->filepath) . '/' . $file->name . '.info';
-      $file->info['_info_file_ctime'] = filectime($info_filename);
-    }
+      // If we still don't know the 'project', give up.
+      if (empty($file->info['project'])) {
+        continue;
+      }
 
-    $project_name = $file->info['project'];
-    if (!isset($projects[$project_name])) {
-      // Only process this if we haven't done this project, since a single
-      // project can have multiple modules or themes.
-      $projects[$project_name] = array(
-        'name' => $project_name,
-        'info' => $file->info,
-        'datestamp' => isset($file->info['datestamp']) ? $file->info['datestamp'] : 0,
-        'includes' => array($file->name => $file->info['name']),
-        'project_type' => $project_name == 'drupal' ? 'core' : $project_type,
-      );
-    }
-    else {
-      $projects[$project_name]['includes'][$file->name] = $file->info['name'];
-      $projects[$project_name]['info']['_info_file_ctime'] = max($projects[$project_name]['info']['_info_file_ctime'], $file->info['_info_file_ctime']);
+      // If we don't already know it, grab the change time on the .info file
+      // itself. Note: we need to use the ctime, not the mtime (modification
+      // time) since many (all?) tar implementations will go out of their way to
+      // set the mtime on the files it creates to the timestamps recorded in the
+      // tarball. We want to see the last time the file was changed on disk,
+      // which is left alone by tar and correctly set to the time the .info file
+      // was unpacked.
+      if (!isset($file->info['_info_file_ctime'])) {
+        $info_filename = dirname($file->filepath) . '/' . $file->name . '.info';
+        $file->info['_info_file_ctime'] = filectime($info_filename);
+      }
+
+      $project_name = $file->info['project'];
+      if (!isset($projects[$project_name])) {
+        // Only process this if we haven't done this project, since a single
+        // project can have multiple modules or themes.
+        $projects[$project_name] = array(
+          'name' => $project_name,
+          'info' => $file->info,
+          'datestamp' => isset($file->info['datestamp']) ? $file->info['datestamp'] : 0,
+          'includes' => array($file->name => $file->info['name']),
+          'project_type' => $project_name == 'drupal' ? 'core' : $project_type,
+        );
+      }
+      else {
+        $projects[$project_name]['includes'][$file->name] = $file->info['name'];
+        $projects[$project_name]['info']['_info_file_ctime'] = max($projects[$project_name]['info']['_info_file_ctime'], $file->info['_info_file_ctime']);
+      }
+      if ($project_subtype == 'base_theme' && !empty($file->subthemes)) {
+        $projects[$project_name]['subthemes'] = $file->subthemes;
+      }
     }
   }
 }
Index: modules/update/update.report.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.report.inc,v
retrieving revision 1.18
diff -u -p -r1.18 update.report.inc
--- modules/update/update.report.inc	6 Jun 2009 06:26:13 -0000	1.18
+++ modules/update/update.report.inc	11 Jun 2009 08:17:47 -0000
@@ -183,6 +183,13 @@ function theme_update_report($data) {
     $row .= t('Includes: %includes', array('%includes' => implode(', ', $project['includes'])));
     $row .= "</div>\n";
 
+    if (!empty($project['subthemes'])) {
+      $row .= '<div class="subthemes">';
+      sort($project['subthemes']);
+      $row .= t('Sub-themes: %subthemes', array('%subthemes' => implode(', ', $project['subthemes'])));
+      $row .= "</div>\n";
+    }
+
     $row .= "</div>\n"; // info div.
 
     if (!isset($rows[$project['project_type']])) {
