From 93e81e9d003d165e45182f9aafd4fb0bf6d9c00d Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Tue, 16 Feb 2016 10:42:33 -0800 Subject: [PATCH] enforce maximum archives --- models/site.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/site.rb b/models/site.rb index 1d442e4d..6e5e6ef3 100644 --- a/models/site.rb +++ b/models/site.rb @@ -624,6 +624,11 @@ class Site < Sequel::Model def add_to_ipfs # Not ideal. An SoA version is in progress. + + if archives_dataset.count > Archive::MAXIMUM_ARCHIVES_PER_SITE + archives_dataset.order(:updated_at).first.destroy + end + if $config['ipfs_ssh_host'] && $config['ipfs_ssh_user'] rbox = Rye::Box.new $config['ipfs_ssh_host'], :user => $config['ipfs_ssh_user'] begin