Don't delete pinned file if it removed by owner

This commit is contained in:
shortcutme 2018-10-15 13:09:43 +02:00
parent 0f49d412b5
commit c12454a8e9
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 21 additions and 3 deletions

View file

@ -53,6 +53,10 @@ if "access_log" not in locals().keys(): # To keep between module reloads
@PluginManager.registerTo("ContentManager")
class ContentManagerPlugin(object):
def __init__(self, *args, **kwargs):
self.cache_is_pinned = {}
super(ContentManagerPlugin, self).__init__(*args, **kwargs)
def optionalDownloaded(self, inner_path, hash_id, size=None, own=False):
if "|" in inner_path: # Big file piece
file_inner_path, file_range = inner_path.split("|")
@ -100,6 +104,14 @@ class ContentManagerPlugin(object):
return False
def optionalDelete(self, inner_path):
if self.isPinned(inner_path):
self.site.log.debug("Skip deleting pinned optional file: %s" % inner_path)
return False
else:
return super(ContentManagerPlugin, self).optionalDelete(inner_path)
@PluginManager.registerTo("WorkerManager")
class WorkerManagerPlugin(object):
def doneTask(self, task):