For a generic filter (tracking) I need to make sure that ad_conn package_id is correctly pointing to the package of the object for file.vuh (otherwise it would always be the package of the main site, regardless under which folder and therefore package the file was uploaded).
I was wondering how to do this best. Should I write a filter for /file which sits between the filter filling the ns_set for ad_conn and my generic filter, overwriting the package_id with the "correct" one (for my purposes). Probably not...
Alternatively I could modify file.vuh manually to rewrite the tracked information, though it would mean forking file.vuh, not nice either.
Last but not least I could have a sweeper on my tracking data which cleans it up (meaning sets the correct package_id and subsite_id for all the /file accesses).
I'm raising this here because some others might also stumble upon the fact that ad_conn uses the package_id according to site_map, not according to object. Maybe we could add an object_package_id to ad_conn, I don't know how useful that might be though.
Just in case, here is the addition to ad_conn in the default section
recursion_count {
# sometimes recusion_count will be uninitialized and
# something will call ad_conn recursion_count - return 0
# in that instance. This is filters ahead of rp_filter which throw
# an ns_returnnotfound or something like that.
set ad_conn(recursion_count) 0
return 0
}
object_package_id {
# Package_id of the object_viewed
set ad_conn(object_package_id) [acs_object::package_id -object_id $ad_conn(object_id)]
return $ad_conn(object_package_id)
}
default {
return [ns_conn $var]
}