Index: openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl,v diff -u -N -r1.41.2.25 -r1.41.2.26 --- openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl 14 Jul 2020 19:43:09 -0000 1.41.2.25 +++ openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl 27 Jul 2020 17:47:03 -0000 1.41.2.26 @@ -332,9 +332,36 @@ return "" } - - - + PackageMgr instproc fix_site_wide_package_ids {} { + # + # In case, site-wide pages were moved to the global instance, fix + # the package ids. + # + set site_info [:require_site_wide_info] + set package_id [dict get $site_info instance_id] + set item_ids [xo::db::CrClass get_child_item_ids \ + -item_id [dict get $site_info folder_id]] + if {[llength $item_ids] > 0} { + xo::dc transaction { + # + # Fix items + # + xo::dc dml fix_package_ids1 [subst { + update acs_objects set package_id = :package_id + where object_id in ([ns_dbquotelist $item_ids]) + }] + # + # Fix revisions + # + xo::dc dml fix_package_ids2 [subst { + update acs_objects set package_id = :package_id + where object_id in (select revision_id from cr_revisions + where item_id in ([ns_dbquotelist $item_ids])) + }] + } + } + } + PackageMgr ad_instproc initialize { -ad_doc {-parameter ""}