FLX
FLX

Reputation: 4714

Retrieve/iterate Redmine wiki content and return it?

I'm trying to achieve a simple plugin that takes the current wiki page content and matches/replaces everytime a word occurs via regular expression/ The regular expression part itself is easy, I'm more interested in how to retrieve/iterate the wiki content and return it after replacing. How can I do this?

Thanks!

Dennis

Upvotes: 0

Views: 198

Answers (1)

rm-rf
rm-rf

Reputation: 1333

If you're writing a plugin, I'm sure you know their source is available on github, and if you check that out you can use the models they already provide. I haven't tested, but it looks like if you:

require "#{path_to_redmine_source}/app/models/wiki_content"
WikiContent.all.each do |post|
  post.text.gsub!(/important_data/, "nonsense")
  post.save!
end

that should work, and it will use whatever adapter's redmine already has configured. It will, however, require loading all the plugins that redmine uses, which could suck.

Upvotes: 1

Related Questions