Forum OpenACS Development: Play with Content Repository

Collapse
Posted by Iuri Sampaio on
Hi there,

I have two question regarding content repository:

1. i want to replicate the structure in the content repository to the OS filesystem
I treated all the special characters. However i had problems with some directories. Their names are too long in the CR and that is not allowed to create directories in the OS.
Does anyone know how to trick that to keep the original filenames?

2. The other question is about files in the CR.
How do i walk through the content repository using the field tree_sortkey of the table cr_items.
I want to locate the file and copy it to the new OS filesystem.
I tried to use the academic concepts of filesystem organization such as binary tree search but i failed. 😊
any ideas?

Collapse
Posted by Iuri Sampaio on
By the way,

why file storage allows name larger than 255 bytes?

Collapse
Posted by Dave Bauer on
The length on cr_items.name is 400 characters. Do you really have a directory name that is that long?

The filesystem filename is stored on postgresql in cr_revisions.content. From there you can get the path under content-repository-content-files directory to locate the file.

Collapse
Posted by Iuri Sampaio on
regarding cr_items.name,
The client came up with the necessity to replicate CR to the filesystem.

I will play a bit with the API [fs::publish_object_to_file_system] and see what happens.

Unless there is a good motive to 400 chars, in my view the field should be limited to 255 chars.

i hadn't looked at cr_revisions table before i open the thread. To track the path of the file is much easier than i thought. Somehow i thought CR used a complex method to organize them. I always go through the hardest way! Thanks!

Collapse
Posted by Dave Bauer on
Yeah look through all the CR apis. There is a tcl proc to get the file path and probably useful procs for your task.

re: cr_items.name, I doubt we will change that now, but you can certainly limit it in your application.