Commit ed365662 authored by drumm's avatar drumm
Browse files

Issue #3104698 by drumm: project_release_has_full_release() is really...

Issue #3104698 by drumm: project_release_has_full_release() is really Drupal.org-specific, remove it
parent ba396caa
......@@ -1319,43 +1319,6 @@ function project_release_field_formatter_view($entity_type, $entity, $field, $in
return $element;
}
/**
* Determine if a project has a supported full release.
*
* @param $node
* A project node.
*
* @return
* TRUE if there is a supported full release, otherwise FALSE.
*/
function project_release_has_full_release(stdClass $node) {
// Get “Recommended” API compatibilities that can be shown on the project
// page.
$recommended_term_result = (new EntityFieldQuery())
->entityCondition('entity_type', 'taxonomy_term')
->fieldCondition('field_release_recommended', 'value', 1)
->execute();
$api_tids = array_keys($recommended_term_result['taxonomy_term']);
// Get “Supported” release NIDs in supported branches.
$recommended_releases = db_query('SELECT recommended_release FROM {project_release_supported_versions} WHERE nid = :nid AND supported = 1 AND tid IN (:tids)', [
':nid' => $node->nid,
':tids' => $api_tids,
])->fetchCol();
if (count($recommended_releases) === 0) {
return FALSE;
}
// Check if those releases have extra versions, like alpha42 or dev.
$query = new EntityFieldQuery();
$with_extra_release_count = $query->entityCondition('entity_type', 'node')
->entityCondition('bundle', project_release_release_node_types())
->propertyCondition('status', NODE_PUBLISHED)
->propertyCondition('nid', $recommended_releases)
->fieldCondition('field_release_version_extra', 'value', '', '<>')
->count()->execute();
// If there are full releases, recommended without extra.
return count($recommended_releases) - $with_extra_release_count > 0;
}
/**
* Find releases, optionally limited to a branch and major, ordered by version.
*
......@@ -2064,8 +2027,5 @@ function project_release_apachesolr_index_document_build_node(ApacheSolrDocument
if (isset($result['node'])) {
$document->addField('ds_project_latest_release', apachesolr_date_iso(node_load(array_keys($result['node'])[0])->created));
}
// Add if the project has a supported full release.
$document->addField('bs_project_release_has_full', project_release_has_full_release($node));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment