cvs diff: Diffing modules/update_status Index: modules/update_status/update_status.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/update_status/update_status.module,v retrieving revision 1.38 diff -u -p -r1.38 update_status.module --- modules/update_status/update_status.module 8 Jun 2007 07:21:59 -0000 1.38 +++ modules/update_status/update_status.module 8 Jun 2007 11:18:00 -0000 @@ -22,7 +22,7 @@ define('UPDATE_STATUS_HAVE_NEWER', 6); function update_status_help($section) { switch ($section) { case 'admin/logs/updates': - return '
'. t('Here you can find information on the update status of your installed modules. Note that each module is part of a "project", which may have the same name as the module or may have a different name. Also note that this can only check the status for "official releases", and will not be able to check update status for development snapshots and modules updated directly from CVS.') .'
'; + return ''. t('Here you can find information on the update status of your installed modules. Note that each module is part of a "project", which may have the same name as the module or may have a different name.') .'
'; case 'admin/build/modules': $status = update_status_requirements('runtime'); if ($status['update_status']['severity'] == REQUIREMENT_ERROR) { @@ -253,71 +253,6 @@ function update_status_force_status() { } /** - * Make a CVS version string more human readable if possible. - */ -function update_status_make_nice_version($version) { - $match = array(); - // The weird concatenation prevents CVS from 'expanding' this $Name. - if (preg_match('/\$'.'Name: (.*?)\$/', $version, $match)) { - // If we matched $Name, we know this is from CVS, so we can try to - // make a human-readable version string. We can assume at least - // 5.x, which simplifies things. Core doesn't use $Name for - // version strings at all, so we can also assume contrib. - $version = update_status_get_version_from_tag(trim($match[1])); - } - return $version; -} - -/** - * Returns the human-readable version string from a given CVS tag. - */ -function update_status_get_version_from_tag($tag) { - // If there's nothing, it must be a HEAD checkout, and therefore, - // we have no idea what the version is. - if (!$tag) { - $version = 'HEAD'; - } - // See if it's a full, official release from a tag: - else if (preg_match('@^DRUPAL-(\d+)--(\d+)-(\d+)(-.+)?@', $tag, $match)) { - $version = $match[1] .'.x-'. $match[2] .'.'. $match[3]; - if (isset($match[4])) { - // This version's tag has 'extra', so clean that up. - $version .= '-'. preg_replace('/[_-]/', '', strtolower($match[4])); - } - } - // If not, see if it's from a branch (like a development snapshot). - else if (preg_match('@^DRUPAL-(\d+)(--(\d+))?@', $tag, $match)) { - $version = $match[1] .'.x-'. (isset($match[3]) ? $match[3] : '1') .'.x-dev'; - } - return $version; -} - -/** - * Try to figure out what kind of installation we have (official - * release, deploy from CVS, etc). If we don't have any version info - * and this is deployed from CVS, see if we can find the version based - * on the sticky tag in the local workspace (the CVS/Tag file). - */ -function update_status_get_install_type(&$info, $file) { - // Assume an official release unless we detect CVS. - $type = 'official'; - $cvs_dir = dirname($file->filename) .'/CVS'; - if (is_dir($cvs_dir)) { - $type = 'cvs'; - if (!isset($info['version'])) { - $tag_file = trim(file_get_contents($cvs_dir .'/Tag')); - $sticky = ''; - if ($tag_file) { - // Get the sticky tag for this workspace: strip off the leading 'T'. - $sticky = preg_replace('@^T@', '', $tag_file); - } - $info['version'] = update_status_get_version_from_tag($sticky); - } - } - return $type; -} - -/** * Fetch an array of installed and enabled projects. * * @todo @@ -337,14 +272,19 @@ function update_status_get_projects() { if (empty($file->status)) { continue; } - - $info = _module_parse_info_file(dirname($file->filename) .'/'. $file->name .'.info'); + $file->info = _module_parse_info_file(dirname($file->filename) .'/'. $file->name .'.info'); // Skip if this is broken. - if (empty($info)) { + if (empty($file->info)) { continue; } + // Give other modules a chance to fill-in and clean the version. + $versions = module_invoke_all('get_version', $file); + $versions = array_values(array_filter($versions)); + $file->info['version'] = $versions[0]; + + $info = $file->info; $info['check'] = TRUE; if (!array_key_exists('project', $info)) { // If we don't know the project yet, first see if this is core: @@ -373,21 +313,14 @@ function update_status_get_projects() { // Only process this if we haven't done this project, since a single // project can have multiple modules. - // This checks if it's a CVS install or not, and populates the - // $info['version'] field if we have a sticky tagged CVS - // workspace but no version data in the .info file. - $type = update_status_get_install_type($info, $file); + // Assume an official release until we see otherwise. + $type = 'official'; if (!array_key_exists('version', $info)) { $type = 'unknown'; $info['version'] = t('Unknown'); } - // Try to sanitize and make the version string more - // human-readable, for example, if this is from CVS and we've - // got a version string using $Name and the CVS tag or branch. - $info['version'] = update_status_make_nice_version($info['version']); - if ($type == 'official' && strpos($info['version'], '-dev') !== FALSE) { $type = 'dev'; } @@ -517,10 +450,6 @@ function update_status_calculate_project $projects[$project]['status'] = UPDATE_STATUS_NOT_CURRENT; } break; - case 'cvs': - $projects[$project]['status'] = UPDATE_STATUS_NOT_CHECKED; - $projects[$project]['reason'] = t('CVS'); - break; case 'dev': $latest_version = $remote[$project]['releases'][$projects[$project]['latest_version']]; cvs diff: Diffing modules/update_status/po cvs diff: Diffing modules/cvs_deploy Index: modules/cvs_deploy/cvs_deploy.info =================================================================== RCS file: modules/cvs_deploy/cvs_deploy.info diff -N modules/cvs_deploy/cvs_deploy.info --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/cvs_deploy/cvs_deploy.info 8 Jun 2007 11:18:00 -0000 @@ -0,0 +1,4 @@ +; $Id$ +name = CVS Deploy +description = Helps sites that are deployed directly from a CVS workspace. +version = "$Name: $" Index: modules/cvs_deploy/cvs_deploy.module =================================================================== RCS file: modules/cvs_deploy/cvs_deploy.module diff -N modules/cvs_deploy/cvs_deploy.module --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/cvs_deploy/cvs_deploy.module 8 Jun 2007 11:18:00 -0000 @@ -0,0 +1,67 @@ +info['version'])) { + // The .info file contains no version data. Find the version based + // on the sticky tag in the local workspace (the CVS/Tag file). + $cvs_dir = dirname($project->filename) .'/CVS'; + if (is_dir($cvs_dir)) { + $tag_file = trim(file_get_contents($cvs_dir .'/Tag')); + $sticky = ''; + if ($tag_file) { + // Get the sticky tag for this workspace: strip off the leading 'T'. + $sticky = preg_replace('@^T@', '', $tag_file); + } + return cvs_deploy_version_from_tag($sticky); + } + } + // The weird concatenation prevents CVS from 'expanding' this $Name. + elseif (preg_match('/\$'.'Name: (.*?)\$/', $project->info['version'], $match)) { + // If we matched $Name, we know this is from CVS, so we can try to + // make a human-readable version string. We can assume at least + // 5.x, which simplifies things. Core doesn't use $Name for + // version strings at all, so we can also assume contrib. + return cvs_deploy_version_from_tag(trim($match[1])); + } + return $project->info['version']; +}