2018-03-26 05:16:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
class ProjectWiki < Wiki
|
2020-10-05 11:08:56 -04:00
|
|
|
self.container_class = Project
|
2020-04-22 08:09:29 -04:00
|
|
|
alias_method :project, :container
|
2014-04-09 07:35:26 -04:00
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
# Project wikis are tied to the main project storage
|
2020-10-05 11:08:56 -04:00
|
|
|
delegate :storage, :repository_storage, :hashed_storage?, :lfs_enabled?, to: :container
|
2014-04-09 07:35:26 -04:00
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
override :disk_path
|
|
|
|
def disk_path(*args, &block)
|
|
|
|
container.disk_path + '.wiki'
|
2015-11-15 14:32:28 -05:00
|
|
|
end
|
2020-09-09 17:08:33 -04:00
|
|
|
|
|
|
|
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-04-09 07:35:26 -04:00
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
# TODO: Remove this once we implement ES support for group wikis.
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/issues/207889
|
2019-09-13 09:26:31 -04:00
|
|
|
ProjectWiki.prepend_if_ee('EE::ProjectWiki')
|