Uploading wiki files to Redmine
Added by Nirmal Sasidharan about 14 years ago
Where does Redmine store its files? I am looking for a process to upload redmine wikifiles (generated offline) to redmine server. I have complete access to the serverand have the possibility to configure it.
Thanks in advance for any help.
Regards,
Nirmal
Replies (9)
RE: Uploading wiki files to Redmine - Added by Felix Schäfer about 14 years ago
The files are stored in the files
directory in the redmine directory, redmine won't be aware about those though, as every file in there is referenced and catalogued in the DB. I'm not aware of a simple scriptable way to push files to redmine currently, sorry.
RE: Uploading wiki files to Redmine - Added by Nirmal Sasidharan about 14 years ago
Oops. Thats gonna hit us really bad :(
We developed a large framework which outputs some redmine files. Our plan was to copy this to the redmine server and make it public. We made a wrong assumption here that we could easily copy files to a redmine wiki server. We are left with only two options now:
- Setup and use any other wiki which allows such a copy (involves effort in adapting our framework to this)
- Write some kind of an extension to redmine to allow this
I have only been a user of redmine until now. Could you please give me some hints on whether approach 2 is feasible. Can we write a redmine plugin to get this done? Or the crude way would be to make the database catalog entries directly. Is this possibe?
Could you please guide us here?
Thanks and regards,
Nirmal
RE: Uploading wiki files to Redmine - Added by Felix Schäfer about 14 years ago
2 Should be feasible without too much fuss. Are you trying to attach files to wiki pages or write stuff in wiki pages?
RE: Uploading wiki files to Redmine - Added by Nirmal Sasidharan about 14 years ago
Thanks for your quick reply.
We do not have a requirement to create attachments. We need to copy the redmine wiki files created to the server (preferably using Java).
Could you give us some pointers on how to go about this?
Do we need to extend the RESTful API (as it currently supports Projects and Issues only)? Or is it simply writing a Redmine plugin?
Nirmal
RE: Uploading wiki files to Redmine - Added by Felix Schäfer about 14 years ago
Nirmal Sasidharan wrote:
We need to copy the redmine wiki files
Ok, that's were we have a slight misunderstanding: the redmine wiki pages are stored in the DB too, so they're not "files" per se.
Anyway, if you can do it on the same server, the "quickest" way would be to use the script/runner
in your redmine directory. You can use that runner as kind of a "redmine shell", which you could for example summon with the 3 CLI options for the project identifier, the wiki page name and a string for the content and could look thus:
#!/path/to/your/redmine/script/runner
project_identifier, wiki_page_name, wiki_content = ARG[1,3]
project = Project.find_by_identifier(project_identifier)
wiki_page = project.wiki.wikipages.find_by_name_or_create(wiki_page_name)
# write the wiki_content to the page, and so on
(This is just written down as it goes, neither tested, nor do I guarantee that it would work like that)
Using such a custom script, you could then call it from whatever program you like, pass it the right arguments and interact with redmine like that. The REST API would sure be a nicer way, but you'd either have to wait it's implemented in core, or make a plugin yourself for it.
Edit: ARG[0]
probably holds the name of the script, changed the example accordingly.
RE: Uploading wiki files to Redmine - Added by Nirmal Sasidharan about 14 years ago
Thanks for your hints.
I will try it out and get back to you.
Regards,
Nirmal
RE: Uploading wiki files to Redmine - Added by Nirmal Sasidharan about 14 years ago
Thanks once again.
I could implement it without any hazzle and it works quite fine.
This is how it looks in short:
project = Project.find_by_name(ARGV[0]) || Project.find_by_identifier(ARGV[0]) if project page = project.wiki.find_or_new_page(ARGV[1]); page.content = WikiContent.new(:text => ARGV[2]) page.save! else ... end
Regards,
Nirmal
RE: Uploading wiki files to Redmine - Added by Nirmal Sasidharan about 14 years ago
Now I am getting more demanding :)
Could you give some hints on how to attach some files to the created wiki page? I can make sure that the files to attach are available on the server.
Thanks in advance,
Regards,
Nirmal
RE: Uploading wiki files to Redmine - Added by Felix Schäfer about 14 years ago
Nirmal Sasidharan wrote:
Could you give some hints on how to attach some files to the created wiki page? I can make sure that the files to attach are available on the server.
No easy way I know of, sorry.