Skip to content

Commit

Permalink
Fix #10873: version inheritance in roadmap and changelog
Browse files Browse the repository at this point in the history
Many thanks to Peter Bruin for providing a fix for this long-standing
issue.
  • Loading branch information
dregad committed Oct 21, 2013
2 parents 0ac2a04 + 747481a commit 88045cf
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions core/version_api.php
Expand Up @@ -403,15 +403,35 @@ function version_cache_array_rows( $p_project_id_array ) {
function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete = false, $p_inherit = null ) {
global $g_cache_versions, $g_cache_versions_project;

if( isset( $g_cache_versions_project[ (int)$p_project_id ] ) ) {
if( !empty( $g_cache_versions_project[ (int)$p_project_id ]) ) {
foreach( $g_cache_versions_project[ (int)$p_project_id ] as $t_id ) {
$t_versions[] = version_cache_row( $t_id );
if ( $p_inherit === null ) {
$t_inherit = ( ON == config_get( 'subprojects_inherit_versions' ) );
} else {
$t_inherit = $p_inherit;
}

if( $t_inherit ) {
$t_project_ids = project_hierarchy_inheritance( $p_project_id );
} else {
$t_project_ids [] = $p_project_id;
}

$t_is_cached = true;
foreach( $t_project_ids as $t_project_id ) {
if( !isset( $g_cache_versions_project[$t_project_id] ) ) {
$t_is_cached = false;
break;
}
}
if( $t_is_cached ) {
$t_versions = array();
foreach( $t_project_ids as $t_project_id ) {
if( !empty( $g_cache_versions_project[$t_project_id]) ) {
foreach( $g_cache_versions_project[$t_project_id] as $t_id ) {
$t_versions[] = version_cache_row( $t_id );
}
}
return $t_versions;
} else {
return array();
}
return $t_versions;
}

$c_project_id = db_prepare_int( $p_project_id );
Expand Down Expand Up @@ -459,7 +479,7 @@ function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete =
* @param int $p_released
* @param bool $p_obsolete
* @return array
*/
*/
function version_get_all_rows_with_subs( $p_project_id, $p_released = null, $p_obsolete = false ) {
$t_project_where = helper_project_specific_where( $p_project_id );

Expand Down Expand Up @@ -623,7 +643,7 @@ function version_get( $p_version_id ) {
* Return a copy of the version structure with all the instvars prepared for db insertion
* @param VersionData $p_version_info
* @return VersionData
*/
*/
function version_prepare_db( $p_version_info ) {
$p_version_info->id = db_prepare_int( $p_version_info->id );
$p_version_info->project_id = db_prepare_int( $p_version_info->project_id );
Expand Down

0 comments on commit 88045cf

Please sign in to comment.