开发者

Retrieve/iterate Redmine wiki content and return it?

I'm trying to achieve a 开发者_如何学Gosimple 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜