Index: openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl,v diff -u -r1.12.2.4 -r1.12.2.5 --- openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl 20 Sep 2022 12:16:39 -0000 1.12.2.4 +++ openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl 15 Feb 2023 17:00:52 -0000 1.12.2.5 @@ -8,6 +8,62 @@ } +namespace eval fs::dav {} + +ad_proc -private fs::dav::require {} { + oacs-dav used to be a requirement for file-storage. We now made + this optional, with the caveat that some operations need to happen + only depending if the package is there or not. +} { + if { ![apm_package_installed_p oacs-dav] } { + # + # Delete the Service Contract implementation if they existed. + # + fs::install::unregister_implementation + + if { [db_table_exists dav_site_node_folder_map] } { + # + # oacs-dav registers folders for access after mount. We remove + # this registration. + # + db_dml unregister_folders { + delete from dav_site_node_folder_map + where folder_id in (select folder_id from fs_root_folders) + } + } + + # + # We do not need to define the DAV callbacks, exit now. + # + return + + } elseif { ![db_0or1row implementation_exists { + select 1 from acs_sc_impls + where impl_owner_name = 'file-storage' + and impl_contract_name = 'dav' + fetch first 1 rows only + }] } { + # + # Check at load time whether the Service Contract implementations + # exist and register them on the fly in case. + # + fs::install::register_implementation + + # + # Map the root folder of all mounted file-storage instances. Do + # not do anything if the DAV folders table has already tuples. + # + db_dml register_folders { + insert into dav_site_node_folder_map + select n.node_id, f.folder_id, true as enabled_p + from fs_root_folders f, + site_nodes n + where n.object_id = f.package_id + and not exists (select 1 from dav_site_node_folder_map) + } + } +} + namespace eval fs::impl::fs_object {} ad_proc -private fs::impl::fs_object::get {} { Fisheye: Tag 1.9.2.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/tcl/file-storage-init.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl,v diff -u -r1.17 -r1.17.2.1 --- openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl 6 Dec 2018 15:48:10 -0000 1.17 +++ openacs-4/packages/file-storage/tcl/file-storage-install-procs.tcl 15 Feb 2023 17:00:52 -0000 1.17.2.1 @@ -15,7 +15,6 @@ setup DAV service contracts } { db_transaction { - register_implementation fs::rss::create_rss_gen_subscr_impl } } @@ -24,7 +23,7 @@ clean up for package uninstall } { db_transaction { - unregister_implementation + fs::install::unregister_implementation fs::rss::drop_rss_gen_subscr_impl } } Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v diff -u -r1.90.2.28 -r1.90.2.29 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 27 Nov 2022 10:52:26 -0000 1.90.2.28 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 15 Feb 2023 17:00:52 -0000 1.90.2.29 @@ -170,7 +170,9 @@ } { set folder_id [fs::get_root_folder -package_id $package_id] - oacs_dav::register_folder -enabled_p "t" $folder_id $node_id + if {[apm_package_installed_p oacs-dav]} { + oacs_dav::register_folder -enabled_p "t" $folder_id $node_id + } } ad_proc -private fs::before_unmount { @@ -182,7 +184,9 @@ } { set folder_id [fs::get_root_folder -package_id $package_id] - oacs_dav::unregister_folder $folder_id $node_id + if {[apm_package_installed_p oacs-dav]} { + oacs_dav::unregister_folder $folder_id $node_id + } } ad_proc -public fs::new_root_folder { @@ -1238,7 +1242,7 @@ } { if {![fs::webdav_p]} { - return "ho" + return "" } if {$package_id eq ""} { set package_id [ad_conn package_id]