Loading drupalorg_project/drupalorg_project.module +1 −1 Original line number Diff line number Diff line Loading @@ -799,7 +799,7 @@ function drupalorg_project_form_node_form_alter(&$form, &$form_state) { $form['field_release_vcs_label']['drupalorg_tag']['#states']['visible'][':input[id=edit-field-release-vcs-label-und-0-value]'][] = ['value' => $label_id]; $version = $form['field_release_vcs_label'][LANGUAGE_NONE][0]['value']['#drupalorg_version_data'][$label_id]; // If there is no extra version component, the release will be stable. if (empty($version['version_extra'])) { if (empty($version['extra'])) { $form['field_release_vcs_label']['drupalorg_tag_stable']['#states']['visible'][':input[id=edit-field-release-vcs-label-und-0-value]'][] = ['value' => $label_id]; // If there is no API compatibility version component, or the API // compatibility is 8.x or 7.x, the release will have security Loading drupalorg_versioncontrol/drupalorg_versioncontrol.module +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ * Implements hook_ctools_plugin_directory(). */ function drupalorg_versioncontrol_ctools_plugin_directory($module, $plugin) { if ($module == 'versioncontrol' || $module == 'versioncontrol_release') { if ($module == 'versioncontrol') { return "plugins/$plugin"; } } Loading drupalorg_versioncontrol/plugins/label_version_mapper/DrupalorgVersioncontrolLabelVersionMapperGit.class.phpdeleted 100644 → 0 +0 −202 Original line number Diff line number Diff line <?php /** * Plugin for drupal.org-specifc mapping of tags and branches to versions. */ class DrupalorgVersioncontrolLabelVersionMapperGit implements VersioncontrolReleaseLabelVersionMapperInterface { public function GetVersionFromLabel($label_name, $label_type, $project_node) { if ($label_type == VERSIONCONTROL_LABEL_TAG) { return $this->GetVersionFromTag($label_name, $project_node); } else { return $this->GetVersionFromBranch($label_name, $project_node); } } public function GetVersionFromTag($tag_name, $project_node) { $version = new stdClass; // Core versions are totally different from contrib. if ($project_node->type === 'project_core') { // Core official versions can be any of the following: // 4.7.0-beta3 // 4.7.0 // 6.18 // 7.0-alpha3 // 7.0 if (preg_match('/^(\d+)\.(\d+)(\.(\d+))?(-((alpha|beta|rc)\d+))?$/', $tag_name, $matches)) { // Starting with version 5 through version 8.0 alphas, we only had 2 // digits, major, and minor. if (($matches[1] >= 5 && $matches[1] <= 7) || ($matches[1] == 8 && $matches[4] == '')) { $version->version_major = $matches[1]; $version->version_minor = $matches[2]; $api_term = $version->version_major . '.x'; } // Prior to 5 and from 8 onward we have all 3: major, minor and patch. else { $version->version_major = $matches[1]; $version->version_minor = $matches[2]; // Match 4 contains the patch level without the leading '.'. if (isset($matches[4])) { $version->version_patch = $matches[4]; } if ($matches[1] <= 4) { // For version 4 and prior, the API compatibility prefix had 3 components // e.g., 4.4.x-1.0 $api_term = $version->version_major . '.' . $version->version_minor . '.x'; } elseif ($matches[1] <= 8) { // For version 5 through 8, the API compatibility prefix has 2 // components e.g., 8.x-1.0. 9 and later no longer have API // compatibility. $api_term = $version->version_major . '.x'; } } // Match 6 contains the version extra without the leading '-'. if (!empty($matches[6])) { $version->version_extra = $matches[6]; } } else { // Unrecognized core tag format. return FALSE; } } else { // Contrib official versions can be any of the following: // 4.7.x-1.0-beta2 // 4.7.x-1.0 // 6.x-1.0-alpha1 // 6.x-1.3 // 6.x-10.0-alpha3 // 3.0.0 // 3.0.1-rc2 if (preg_match('/^(?<api_term>\d+(?:\.\d+)?\.x)-(?<major>\d+)\.(?<minor>\d+)(-(?<extra>(?:alpha|beta|rc)\d+))?$/', $tag_name, $matches)) { $version->version_major = $matches['major']; $version->version_minor = $matches['minor']; if (!empty($matches['extra'])) { $version->version_extra = $matches['extra']; } $api_term = $matches['api_term']; } elseif (preg_match('/^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<extra>(?:alpha|beta|rc)\d+))?$/', $tag_name, $matches)) { $version->version_major = $matches['major']; $version->version_minor = $matches['minor']; $version->version_patch = $matches['patch']; if (!empty($matches['extra'])) { $version->version_extra = $matches['extra']; } } else { // Unrecognized non-core tag format. return FALSE; } } if (isset($api_term) && !self::attachApiTerm($api_term, $version)) { // API term was not valid, so the version string is not valid. return FALSE; } return $version; } public function GetVersionFromBranch($branch_name, $project_node) { $version = new stdClass; // Again, core branches are different from contrib. if ($project_node->type === 'project_core') { // Core branches can be any of these: // 4.7.x // 7.x // 8.1.x // 10.x if (preg_match('/^(\d+)(\.(\d+))?\.x$/', $branch_name, $matches)) { $version->version_major = $matches[1]; if (isset($matches[3]) && ($matches[1] <= 4 || $matches[1] >= 8)) { $version->version_minor = $matches[3]; } // The whole thing should match the API compatibility term, for 7 and lower. if ($version->version_major <= 7) { $api_term = $branch_name; } // Only use 8.x for 8. 9 and later no longer have API compatibility. elseif ($version->version_major == 8) { $api_term = $version->version_major . '.x'; } } else { // Unrecognized core branch format. return FALSE; } } else { // Contrib branches can be any of these: // 4.7.x-1.x // 5.x-2.x // 6.x-10.x // 3.x // 3.1.x if (preg_match('/^(?<api_term>\d+(?:\.\d+)?\.x)-(?<major>\d+)\.x$/', $branch_name, $matches)) { $version->version_major = $matches['major']; $api_term = $matches['api_term']; } elseif (preg_match('/^(?<major>\d+)(?:\.(?<minor>\d+))?\.x$/', $branch_name, $matches)) { $version->version_major = $matches['major']; if (isset($matches['minor'])) { $version->version_minor = $matches['minor']; } } else { // Unrecognized non-core branch format. return FALSE; } } // In both cases, set the least significant regular component to 'x', and // extra to 'dev' for branches. if (isset($version->version_minor)) { $version->version_patch = 'x'; } else { $version->version_minor = 'x'; } $version->version_extra = 'dev'; if (isset($api_term) && !self::attachApiTerm($api_term, $version)) { // API term was not valid, so the version string is not valid. return FALSE; } return $version; } /** * Find API compatibility term by name, attach if found. * * @param string $name * The API term’s name. * @param object $version * A version object to attach term data to. * * @return bool * TRUE on success, FALSE if the term was not found. */ private static function attachApiTerm($name, &$version) { $result = (new EntityFieldQuery())->entityCondition('entity_type', 'taxonomy_term') ->propertyCondition('vid', variable_get('project_release_api_vocabulary', '')) ->propertyCondition('name', $name) ->execute(); // No matching term. if (empty($result)) { return FALSE; } $version->version_api_tid = array_keys($result['taxonomy_term'])[0]; $version->version_api = $name; return TRUE; } } drupalorg_versioncontrol/plugins/label_version_mapper/drupalorg_git.incdeleted 100644 → 0 +0 −8 Original line number Diff line number Diff line <?php $plugin = array( 'title' => t('Map using drupal.org specific logic for Git'), 'mapper' => array( 'class' => 'DrupalorgVersioncontrolLabelVersionMapperGit', ), ); Loading
drupalorg_project/drupalorg_project.module +1 −1 Original line number Diff line number Diff line Loading @@ -799,7 +799,7 @@ function drupalorg_project_form_node_form_alter(&$form, &$form_state) { $form['field_release_vcs_label']['drupalorg_tag']['#states']['visible'][':input[id=edit-field-release-vcs-label-und-0-value]'][] = ['value' => $label_id]; $version = $form['field_release_vcs_label'][LANGUAGE_NONE][0]['value']['#drupalorg_version_data'][$label_id]; // If there is no extra version component, the release will be stable. if (empty($version['version_extra'])) { if (empty($version['extra'])) { $form['field_release_vcs_label']['drupalorg_tag_stable']['#states']['visible'][':input[id=edit-field-release-vcs-label-und-0-value]'][] = ['value' => $label_id]; // If there is no API compatibility version component, or the API // compatibility is 8.x or 7.x, the release will have security Loading
drupalorg_versioncontrol/drupalorg_versioncontrol.module +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ * Implements hook_ctools_plugin_directory(). */ function drupalorg_versioncontrol_ctools_plugin_directory($module, $plugin) { if ($module == 'versioncontrol' || $module == 'versioncontrol_release') { if ($module == 'versioncontrol') { return "plugins/$plugin"; } } Loading
drupalorg_versioncontrol/plugins/label_version_mapper/DrupalorgVersioncontrolLabelVersionMapperGit.class.phpdeleted 100644 → 0 +0 −202 Original line number Diff line number Diff line <?php /** * Plugin for drupal.org-specifc mapping of tags and branches to versions. */ class DrupalorgVersioncontrolLabelVersionMapperGit implements VersioncontrolReleaseLabelVersionMapperInterface { public function GetVersionFromLabel($label_name, $label_type, $project_node) { if ($label_type == VERSIONCONTROL_LABEL_TAG) { return $this->GetVersionFromTag($label_name, $project_node); } else { return $this->GetVersionFromBranch($label_name, $project_node); } } public function GetVersionFromTag($tag_name, $project_node) { $version = new stdClass; // Core versions are totally different from contrib. if ($project_node->type === 'project_core') { // Core official versions can be any of the following: // 4.7.0-beta3 // 4.7.0 // 6.18 // 7.0-alpha3 // 7.0 if (preg_match('/^(\d+)\.(\d+)(\.(\d+))?(-((alpha|beta|rc)\d+))?$/', $tag_name, $matches)) { // Starting with version 5 through version 8.0 alphas, we only had 2 // digits, major, and minor. if (($matches[1] >= 5 && $matches[1] <= 7) || ($matches[1] == 8 && $matches[4] == '')) { $version->version_major = $matches[1]; $version->version_minor = $matches[2]; $api_term = $version->version_major . '.x'; } // Prior to 5 and from 8 onward we have all 3: major, minor and patch. else { $version->version_major = $matches[1]; $version->version_minor = $matches[2]; // Match 4 contains the patch level without the leading '.'. if (isset($matches[4])) { $version->version_patch = $matches[4]; } if ($matches[1] <= 4) { // For version 4 and prior, the API compatibility prefix had 3 components // e.g., 4.4.x-1.0 $api_term = $version->version_major . '.' . $version->version_minor . '.x'; } elseif ($matches[1] <= 8) { // For version 5 through 8, the API compatibility prefix has 2 // components e.g., 8.x-1.0. 9 and later no longer have API // compatibility. $api_term = $version->version_major . '.x'; } } // Match 6 contains the version extra without the leading '-'. if (!empty($matches[6])) { $version->version_extra = $matches[6]; } } else { // Unrecognized core tag format. return FALSE; } } else { // Contrib official versions can be any of the following: // 4.7.x-1.0-beta2 // 4.7.x-1.0 // 6.x-1.0-alpha1 // 6.x-1.3 // 6.x-10.0-alpha3 // 3.0.0 // 3.0.1-rc2 if (preg_match('/^(?<api_term>\d+(?:\.\d+)?\.x)-(?<major>\d+)\.(?<minor>\d+)(-(?<extra>(?:alpha|beta|rc)\d+))?$/', $tag_name, $matches)) { $version->version_major = $matches['major']; $version->version_minor = $matches['minor']; if (!empty($matches['extra'])) { $version->version_extra = $matches['extra']; } $api_term = $matches['api_term']; } elseif (preg_match('/^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(-(?<extra>(?:alpha|beta|rc)\d+))?$/', $tag_name, $matches)) { $version->version_major = $matches['major']; $version->version_minor = $matches['minor']; $version->version_patch = $matches['patch']; if (!empty($matches['extra'])) { $version->version_extra = $matches['extra']; } } else { // Unrecognized non-core tag format. return FALSE; } } if (isset($api_term) && !self::attachApiTerm($api_term, $version)) { // API term was not valid, so the version string is not valid. return FALSE; } return $version; } public function GetVersionFromBranch($branch_name, $project_node) { $version = new stdClass; // Again, core branches are different from contrib. if ($project_node->type === 'project_core') { // Core branches can be any of these: // 4.7.x // 7.x // 8.1.x // 10.x if (preg_match('/^(\d+)(\.(\d+))?\.x$/', $branch_name, $matches)) { $version->version_major = $matches[1]; if (isset($matches[3]) && ($matches[1] <= 4 || $matches[1] >= 8)) { $version->version_minor = $matches[3]; } // The whole thing should match the API compatibility term, for 7 and lower. if ($version->version_major <= 7) { $api_term = $branch_name; } // Only use 8.x for 8. 9 and later no longer have API compatibility. elseif ($version->version_major == 8) { $api_term = $version->version_major . '.x'; } } else { // Unrecognized core branch format. return FALSE; } } else { // Contrib branches can be any of these: // 4.7.x-1.x // 5.x-2.x // 6.x-10.x // 3.x // 3.1.x if (preg_match('/^(?<api_term>\d+(?:\.\d+)?\.x)-(?<major>\d+)\.x$/', $branch_name, $matches)) { $version->version_major = $matches['major']; $api_term = $matches['api_term']; } elseif (preg_match('/^(?<major>\d+)(?:\.(?<minor>\d+))?\.x$/', $branch_name, $matches)) { $version->version_major = $matches['major']; if (isset($matches['minor'])) { $version->version_minor = $matches['minor']; } } else { // Unrecognized non-core branch format. return FALSE; } } // In both cases, set the least significant regular component to 'x', and // extra to 'dev' for branches. if (isset($version->version_minor)) { $version->version_patch = 'x'; } else { $version->version_minor = 'x'; } $version->version_extra = 'dev'; if (isset($api_term) && !self::attachApiTerm($api_term, $version)) { // API term was not valid, so the version string is not valid. return FALSE; } return $version; } /** * Find API compatibility term by name, attach if found. * * @param string $name * The API term’s name. * @param object $version * A version object to attach term data to. * * @return bool * TRUE on success, FALSE if the term was not found. */ private static function attachApiTerm($name, &$version) { $result = (new EntityFieldQuery())->entityCondition('entity_type', 'taxonomy_term') ->propertyCondition('vid', variable_get('project_release_api_vocabulary', '')) ->propertyCondition('name', $name) ->execute(); // No matching term. if (empty($result)) { return FALSE; } $version->version_api_tid = array_keys($result['taxonomy_term'])[0]; $version->version_api = $name; return TRUE; } }
drupalorg_versioncontrol/plugins/label_version_mapper/drupalorg_git.incdeleted 100644 → 0 +0 −8 Original line number Diff line number Diff line <?php $plugin = array( 'title' => t('Map using drupal.org specific logic for Git'), 'mapper' => array( 'class' => 'DrupalorgVersioncontrolLabelVersionMapperGit', ), );