Index: openacs-4/packages/file-storage/tcl/file-storage-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-init.tcl,v diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- openacs-4/packages/file-storage/tcl/file-storage-init.tcl 20 Apr 2001 20:51:10 -0000 1.1.1.1 +++ openacs-4/packages/file-storage/tcl/file-storage-init.tcl 17 Mar 2002 04:21:07 -0000 1.1.1.1.2.1 @@ -7,3 +7,25 @@ @cvs-id $Id$ } +# JS: proc to execute every time a new package instance is created. +# This avoids the ugly hack in the original version that checks for +# the existence of a root folder every time fs_get_root_folder is called +# (i.e., every visit to a file-storage tree!) Essentially, we let APM +# do part of what fs_get_root_folder does, once, i.e., when the package instance +# is created. We save a query (albeit an inexpensive one) since we can simplify +# fs_get_root_folder to not do the check for the root folder anymore. + +# Note that APM calls the proc with a name that uses the "package-key" +# (all "-" replaced by "_") concatenated with the string +# "post_instantiation". The parameter passed is always +# package_id. The name of the proc is thus: + +ad_proc file_storage_post_instantiation { + package_id +} { + Post package instantiation procedure to insert a package_id, + folder_id pair in fs_root_folders +} { + # We should probably just define this function here, and remove from the fs namespace + return [fs::new_root_folder -package_id $package_id] +}