Commit c6d5e54b authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Another update to the subosid problems caused by unifying os_info

and images.
parent 5d736c2a
...@@ -800,7 +800,7 @@ my $defaultosidquery = ...@@ -800,7 +800,7 @@ my $defaultosidquery =
# No need to use osidtoimageid here cause: # No need to use osidtoimageid here cause:
# 1. We only support EZ images now (osid=imageid). # 1. We only support EZ images now (osid=imageid).
# #
my $subosidquery = my $subosidquery1 =
"select distinct o.osid,o.parent_osid,ov1.def_parentosid ". "select distinct o.osid,o.parent_osid,ov1.def_parentosid ".
" from os_submap as o " . " from os_submap as o " .
"left join images as i1 on i1.imageid = o.osid ". "left join images as i1 on i1.imageid = o.osid ".
...@@ -823,19 +823,30 @@ my $subosidquery = ...@@ -823,19 +823,30 @@ my $subosidquery =
" ip2.permission_type='user' and ip2.permission_idx=u2.uid_idx ". " ip2.permission_type='user' and ip2.permission_idx=u2.uid_idx ".
"where (i1.imageid is null or iv1.global = 1"; "where (i1.imageid is null or iv1.global = 1";
if ($pid) { if ($pid) {
$subosidquery .= " or i1.pid='$pid' or g1.pid='$pid'"; $subosidquery1 .= " or i1.pid='$pid' or g1.pid='$pid'";
} }
if ($this_user) { if ($this_user) {
$subosidquery .= " or u1.uid='$this_user'" $subosidquery1 .= " or u1.uid='$this_user'"
} }
$subosidquery .= ") and (iv2.global = 1"; $subosidquery .= ") and (iv2.global = 1";
if ($pid) { if ($pid) {
$subosidquery .= " or i2.pid='$pid' or g2.pid='$pid'"; $subosidquery1 .= " or i2.pid='$pid' or g2.pid='$pid'";
} }
if ($this_user) { if ($this_user) {
$subosidquery .= " or u2.uid='$this_user'" $subosidquery .= " or u2.uid='$this_user'"
} }
$subosidquery .= ")"; $subosidquery1 .= ")";
my $subosidquery2 =
"select distinct o.osid,o.parent_osid,ov.def_parentosid ".
" from os_submap as o " .
"left join os_info as oi on oi.osid = o.osid ".
"left join os_info_versions as ov on ".
" ov.osid=oi.osid and ov.vers=oi.version ".
"left join os_info as oip on oip.osid = o.parent_osid ".
"left join os_info_versions as ovp on ".
" ovp.osid=oip.osid and ovp.vers=oip.version ".
"where (ov.shared=1 and ovp.shared=1 and ov.ezid=0 and ovp.ezid=0)";
our %node_type_osids; our %node_type_osids;
our %osid_node_types; our %osid_node_types;
...@@ -916,16 +927,18 @@ sub processOs ...@@ -916,16 +927,18 @@ sub processOs
# #
# XXX Note below that for now, subosids cannot redirect to other subosids. # XXX Note below that for now, subosids cannot redirect to other subosids.
# #
$result = DBQueryFatal($subosidquery); foreach my $q ($subosidquery1, $subosidquery2) {
while (my ($subosid,$osid,$defparent) = $result->fetchrow()) { $result = DBQueryFatal($q);
if ($osid_subosids{$osid}) { while (my ($subosid,$osid,$defparent) = $result->fetchrow()) {
push @{$osid_subosids{$osid}}, $subosid; if ($osid_subosids{$osid}) {
} else { push @{$osid_subosids{$osid}}, $subosid;
$osid_subosids{$osid} = [$subosid]; } else {
} $osid_subosids{$osid} = [$subosid];
# This is default parent. See below, used for image aliases. }
if (defined($defparent) && $defparent == $osid) { # This is default parent. See below, used for image aliases.
$osid_defparent{$subosid} = $defparent; if (defined($defparent) && $defparent == $osid) {
$osid_defparent{$subosid} = $defparent;
}
} }
} }
......
Markdown is supported
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