Version 67 DeleteOrphans improvement

This commit is contained in:
Hydrus 2013-04-24 16:45:51 -05:00
parent 328a014200
commit 5d8f93c759
2 changed files with 32 additions and 6 deletions

View File

@ -17,6 +17,7 @@
<li>subs and repos will automatically pause while their respective dialogs are open</li>
<li>new namespace | regex listctrl in regex dialog, instead of old sctvcp rubbish</li>
<li>new /aa/aa...0 file storage system for client</li>
<li>fixed deleteorphans mime issue</li>
<li>export and copy files now export writeable files, not read-only</li>
<li>rejiggered daemon db access, improving maintenance reliablity</li>
<li>dumper and 'show in new page' pages now process content updates correctly</li>

View File

@ -1728,13 +1728,38 @@ class ServiceDB( FileDB, MessageDB, TagDB, RatingDB ):
for hash in local_files_hashes & deletee_hashes:
with self._hashes_to_mimes_lock: mime = self._hashes_to_mimes[ hash ]
with self._hashes_to_mimes_lock:
# not sure why I'm ever getting a key error here, but let's recover from it anyway!
if hash in self._hashes_to_mimes: mime = self._hashes_to_mimes[ hash ]
else: mime = None
path = CC.GetFilePath( hash, mime )
os.chmod( path, stat.S_IWRITE )
os.remove( path )
if mime is None:
for mime in HC.ALLOWED_MIMES:
path = CC.GetFilePath( hash, mime )
if os.path.exists( path ):
os.chmod( path, stat.S_IWRITE )
os.remove( path )
break
else:
path = CC.GetFilePath( hash, mime )
os.chmod( path, stat.S_IWRITE )
os.remove( path )
# perceptual_hashes and thumbs