debian-mirror-gitlab/app/models/project_wiki.rb

36 lines
1.1 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2020-05-24 23:13:21 +05:30
class ProjectWiki < Wiki
2021-01-03 14:25:43 +05:30
self.container_class = Project
2020-05-24 23:13:21 +05:30
alias_method :project, :container
2014-09-02 18:07:02 +05:30
2020-05-24 23:13:21 +05:30
# Project wikis are tied to the main project storage
2021-01-03 14:25:43 +05:30
delegate :storage, :repository_storage, :hashed_storage?, :lfs_enabled?, to: :container
2014-09-02 18:07:02 +05:30
2020-05-24 23:13:21 +05:30
override :disk_path
def disk_path(*args, &block)
container.disk_path + '.wiki'
2015-11-26 14:37:03 +05:30
end
2020-11-24 15:15:51 +05:30
override :after_wiki_activity
def after_wiki_activity
# Update activity columns, this is done synchronously to avoid
# replication delays in Geo.
project.touch(:last_activity_at, :last_repository_updated_at)
end
override :after_post_receive
def after_post_receive
# Update storage statistics
ProjectCacheWorker.perform_async(project.id, [], [:wiki_size])
# This call is repeated for post-receive, to make sure we're updating
# the activity columns for Git pushes as well.
after_wiki_activity
end
2014-09-02 18:07:02 +05:30
end
2019-12-04 20:38:33 +05:30
2020-05-24 23:13:21 +05:30
# TODO: Remove this once we implement ES support for group wikis.
# https://gitlab.com/gitlab-org/gitlab/-/issues/207889
2019-12-04 20:38:33 +05:30
ProjectWiki.prepend_if_ee('EE::ProjectWiki')