summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorLoic Nageleisen <loic.nageleisen@gmail.com>2014-03-28 21:15:25 +0100
committerLoic Nageleisen <loic.nageleisen@gmail.com>2014-06-07 11:14:33 +0200
commitc1ccc3a57b8e335c014e3176f3255ed74703572f (patch)
tree66eeeffeb0bb55d60eefde0d441001d63875098c /app/models
parentab094e67eed54f5c29a33d2114cc91908e543972 (diff)
downloadgitlab-ce-c1ccc3a57b8e335c014e3176f3255ed74703572f.tar.gz
Added ability to serve files in wiki repository
From #6168.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project_wiki.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index 08a52782475..a8ba5efcc7c 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -72,6 +72,15 @@ class ProjectWiki
end
end
+ def find_file(name, version = nil, try_on_disk = true)
+ version = wiki.ref if version.nil? # Gollum::Wiki#file ?
+ if wiki_file = wiki.file(name, version, try_on_disk)
+ wiki_file
+ else
+ nil
+ end
+ end
+
def create_page(title, content, format = :markdown, message = nil)
commit = commit_details(:created, message, title)