Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/pages_deployment.rb')
-rw-r--r--app/models/pages_deployment.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/pages_deployment.rb b/app/models/pages_deployment.rb
index 0d87a8f6cf6..e8b186234af 100644
--- a/app/models/pages_deployment.rb
+++ b/app/models/pages_deployment.rb
@@ -20,6 +20,7 @@ class PagesDeployment < ApplicationRecord
scope :with_files_stored_locally, -> { where(file_store: ::ObjectStorage::Store::LOCAL) }
scope :with_files_stored_remotely, -> { where(file_store: ::ObjectStorage::Store::REMOTE) }
scope :project_id_in, ->(ids) { where(project_id: ids) }
+ scope :ci_build_id_in, ->(ids) { where(ci_build_id: ids) }
scope :with_path_prefix, ->(prefix) { where("COALESCE(path_prefix, '') = ?", prefix.to_s) }
# We have to mark the PagesDeployment upload as ready to ensure we only
@@ -28,6 +29,7 @@ class PagesDeployment < ApplicationRecord
scope :active, -> { upload_ready.where(deleted_at: nil).order(created_at: :desc) }
scope :deactivated, -> { where('deleted_at < ?', Time.now.utc) }
+ scope :versioned, -> { where.not(path_prefix: [nil, '']) }
validates :file, presence: true
validates :file_store, presence: true, inclusion: { in: ObjectStorage::SUPPORTED_STORES }
@@ -62,6 +64,10 @@ class PagesDeployment < ApplicationRecord
.update_all(updated_at: now, deleted_at: time || now)
end
+ def self.deactivate
+ update(deleted_at: Time.now.utc)
+ end
+
private
def set_size