diff --git a/includes/updater.inc b/includes/updater.inc index d86040c5b01d781cbe54a02d10fdb5cfb617ede1..b49d5d21fc1e1ffcf8fbdbdfc1cb9bd29d2b1adc 100644 --- a/includes/updater.inc +++ b/includes/updater.inc @@ -137,7 +137,7 @@ public static function getUpdaterFromDirectory($directory) { * Path to the info file. */ public static function findInfoFile($directory) { - $info_files = file_scan_directory($directory, '/.*\.info/'); + $info_files = file_scan_directory($directory, '/.*\.info$/'); if (!$info_files) { return FALSE; } @@ -179,8 +179,11 @@ public static function getProjectName($directory) { public static function getProjectTitle($directory) { $info_file = self::findInfoFile($directory); $info = drupal_parse_info_file($info_file); - if (!$info) { - throw new UpdaterException(t('Unable to parse info file.')); + if (empty($info)) { + throw new UpdaterException(t('Unable to parse info file: %info_file.', array('%info_file' => $info_file))); + } + if (empty($info['name'])) { + throw new UpdaterException(t("The info file (%info_file) does not define a 'name' attribute.", array('%info_file' => $info_file))); } return $info['name']; } diff --git a/modules/update/update.module b/modules/update/update.module index 8891a506709ca24e9a0dd358cd2143365a1bb022..a4a4c3e8ce1929afa3b3b6c9683634cbca7796c1 100644 --- a/modules/update/update.module +++ b/modules/update/update.module @@ -696,14 +696,14 @@ function update_verify_update_archive($project, $archive_file, $directory) { // Parse all the .info files and make sure they're compatible with this // version of Drupal core. $incompatible = array(); - $files = file_scan_directory("$directory/$project", '/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info/', array('key' => 'name', 'min_depth' => 0)); + $files = file_scan_directory("$directory/$project", '/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info$/', array('key' => 'name', 'min_depth' => 0)); foreach ($files as $key => $file) { // Get the .info file for the module or theme this file belongs to. $info = drupal_parse_info_file($file->uri); // If the module or theme is incompatible with Drupal core, set an error. if (empty($info['core']) || $info['core'] != DRUPAL_CORE_COMPATIBILITY) { - $incompatible[] = $info['name']; + $incompatible[] = !empty($info['name']) ? $info['name'] : t('Unknown'); } } if (!empty($incompatible)) {