Hi. I've identified a couple of problems that I have solutions for in file storage; this thread will be a (short-lived) clearinghouse for that.
First, for your viewing pleasure, is the journal I kept while manually migrating the files in my file storage.
---
(in the description that follows, the table old_new_map is defined as
create table old_new_map
(
object_id_old int;
object_id_new int;
);
)
The first backup is after migrating users.
Next thing to do is add subsites which include a group of members;
for each, add them to the mapping table.
Then add the additional groups (that have nothing to do with subsites)
and add them to the mapping table.
also note that Steve Erquiagua tried once to register, got user 6677, he didn't get in,
then he tried again, and got 6679; this is reflected in the perms of his
file storage folder. (so: take 6677 out of old_new_map and out of where it
exists somewhere in /home/nsadmin/filestorage-dump/(...)/perms)
There are two tables that need "on delete cascade" on their fk constraints. This is needed to be able to delete
here are the alter-table sql statements to do that:
alter table
dav_site_node_folder_map
drop constraint
dav_impls_folder_id_fk;
alter table
dav_site_node_folder_map
add constraint
dav_impls_folder_id_fk
foreign key (folder_id)
references cr_folders
on delete cascade;
alter table
fs_root_folders
drop constraint
fs_root_folder_folder_id_fk;
alter table
fs_root_folders
add constraint
fs_root_folder_folder_id_fk
foreign key (folder_id)
references cr_folders
on delete cascade;
After this, delete the file-storage instance mounted on /files, create a new
one, mount it on /files and set its parameters as follows:
- AllowTextEdit 1
- BehaveLikeFilesystemP 1
- CategoriesP 1
- ExposeRssP 1
- GeneralCommentsP 1
- StoreFilesInDatabaseP 1
- UseWebDavP 1
Then save the params.
Also, had to fix the define_function_args call for plpgsql func
content_type__is_content_type, which should receive one arg called object_type. Reason, this call kept returning false for every call, even when passing 'content_revision', the base case.
update
acs_function_args
set
arg_name = 'OBJECT_TYPE'
where function = 'CONTENT_TYPE__IS_CONTENT_TYPE';
Previously, folders were not created correctly, they were missing some
type registrations. This was fixed by exporting the type registrations for
each folder, then importing only those types that are content types; this
was done in put-files/write-folders.tcl.
had to add (0,0) to old_new_map table; a permission referred to 0
(which is unregistered visitor)
This part starts to get weird... at this point I'm doing surgery on
file-storage because it's lying about the table and id column to use
for the content type file_storage_object, and saying fs_root_folders
is that table, but that's wrong, and the consequence is you can't use
content::* on them because they just don't work that way. I tried
setting them blank but that didn't work (turns out later that it does work; I didn't call the refreshes), so I'm making a table with
just an id column. Here's the sql to do that:
create table
file_storage_objects
(fs_object_id integer);
update acs_object_types set
table_name = 'file_storage_objects',
id_column = 'fs_object_id'
where
object_type = 'file_storage_object';
select content_type__refresh_view('file_storage_object');
select content_type__refresh_trigger('file_storage_object');
Here's another version, to make the table blank. Note that this is a case where NULL and '' are -not- the same.
update acs_object_types set
table_name = NULL,
id_column = NULL
where
object_type = 'file_storage_object';
select content_type__refresh_view('file_storage_object');
select content_type__refresh_trigger('file_storage_object');
You want to run this BEFORE putting anything other than folders into any
file-storage instance.
This should be the second backup (but I think "Stuff" was done wrong).
Also, all the folders, items and revisions should have package_id set to the
file-storage package.
Folders now import fine, and having imported them, did backup three.
there are 5 sets of item perms, which we will apply later; the privileges
are always cm_perm and cm_write, which is not installed on the new openacs
and I don't know what they are yet.
present status, folders work, items are finally importing, but there are
two copies: one in the db, one in a file under /web/service... daveb says
he thinks it's a bug in content::revision::update_content(), and the bug
is that it calls cr_create_content_file in the place where it's trying to
write a lob, which it succeeds at doing. (a little more detail, the call
I refer to is in the top half of an if statement inside the "lob" case of
the switch statement in content::revision::update_content() )
tried commenting that call out; it works. but an elusive permission problem
is now preventing us from seeing the imported files; we can see folders and
items, just not revisions.
Solved. The problem was in one of my import scripts; the revision id fed to the "set live revision"
call was the id from the old openacs, and was not mapped to the new one. So I added a map() surrounding the old id.
Only thing left is a mime type issue where in at least one case the mime
type "text/html; charset=iso-8859-1" is not present in the table
"cr_mime_types".
try this:
insert into cr_mime_types
(mime_type, file_extension)
values
('text/html; charset=iso-8859-1', 'adp');
because this row was found in the old 4.6.3 openacs.