From 1bb8993aad4cbf9bb0852cf0830453fe62f92c8c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 17 Sep 2010 02:28:37 +0000 Subject: - Patch #909272 by moshe weitzman, David_Rothstein: remove stub update functions and renumber the remaining ones. --- includes/update.inc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'includes') diff --git a/includes/update.inc b/includes/update.inc index ff7fc696c..c4efc1b7d 100644 --- a/includes/update.inc +++ b/includes/update.inc @@ -992,15 +992,27 @@ function update_get_update_list() { continue; } + $last_file_name = NULL; $updates = drupal_map_assoc($updates); foreach (array_keys($updates) as $update) { if ($update > $schema_version) { - // The description for an update comes from its Doxygen. + // Omit stub functions that just carry doxygen for developers. $func = new ReflectionFunction($module . '_update_' . $update); - $description = str_replace(array("\n", '*', '/'), '', $func->getDocComment()); - $ret[$module]['pending'][$update] = "$update - $description"; - if (!isset($ret[$module]['start'])) { - $ret[$module]['start'] = $update; + // Only read file contents once per .install file. + $current_file_name = $func->getFileName(); + if ($current_file_name != $last_file_name) { + $file = file($current_file_name); + $last_file_name = $current_file_name; + } + // Slice out just the body of the function. + $body = array_slice($file, $func->getStartLine(), ($func->getEndLine() - $func->getStartLine()-1)); + if (trim(implode('', $body))) { + // The description for an update comes from its Doxygen. + $description = str_replace(array("\n", '*', '/'), '', $func->getDocComment()); + $ret[$module]['pending'][$update] = "$update - $description"; + if (!isset($ret[$module]['start'])) { + $ret[$module]['start'] = $update; + } } } } -- cgit v1.2.3