cc-4292: Initial fix of the MD5 issue. Now MD5's are only collected not really used for anything. Moves are handled completely
through paths.
This commit is contained in:
parent
6c1d7fedc1
commit
355b0ad35d
|
@ -513,11 +513,11 @@ class ApiController extends Zend_Controller_Action
|
|||
$file->setMetadata($md);
|
||||
}
|
||||
} elseif ($mode == "moved") {
|
||||
$md5 = $md['MDATA_KEY_MD5'];
|
||||
$file = Application_Model_StoredFile::RecallByMd5($md5);
|
||||
$file = Application_Model_StoredFile::RecallByFilepath(
|
||||
$md['MDATA_KEY_ORIGINAL_PATH']);
|
||||
|
||||
if (is_null($file)) {
|
||||
return "File doesn't exist in Airtime.";
|
||||
$return_hash['error'] = 'File does not exist in Airtime';
|
||||
} else {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
//$filepath = str_replace("\\", "", $filepath);
|
||||
|
@ -661,6 +661,7 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
} elseif ($mode == "moved") {
|
||||
$md5 = $md['MDATA_KEY_MD5'];
|
||||
Logging::info("Original path: {$md['MDATA_KEY_ORIGINAL_PATH']}");
|
||||
$file = Application_Model_StoredFile::RecallByMd5($md5);
|
||||
|
||||
if (is_null($file)) {
|
||||
|
|
|
@ -110,7 +110,7 @@ class BaseEvent(Loggable):
|
|||
# nothing to see here, please move along
|
||||
def morph_into(self, evt):
|
||||
self.logger.info("Morphing %s into %s" % ( str(self), str(evt) ) )
|
||||
self._raw_event = evt
|
||||
self._raw_event = evt._raw_event
|
||||
self.path = evt.path
|
||||
self.__class__ = evt.__class__
|
||||
# Clean up old hook and transfer the new events hook
|
||||
|
@ -181,11 +181,14 @@ class MoveFile(BaseEvent, HasMetaData):
|
|||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MoveFile, self).__init__(*args, **kwargs)
|
||||
def old_path(self):
|
||||
return self._raw_event.src_pathname
|
||||
def pack(self):
|
||||
req_dict = {}
|
||||
req_dict['mode'] = u'moved'
|
||||
req_dict['MDATA_KEY_MD5'] = self.metadata.extract()['MDATA_KEY_MD5']
|
||||
req_dict['MDATA_KEY_ORIGINAL_PATH'] = self.old_path()
|
||||
req_dict['MDATA_KEY_FILEPATH'] = unicode( self.path )
|
||||
req_dict['MDATA_KEY_MD5'] = self.metadata.extract()['MDATA_KEY_MD5']
|
||||
return [req_dict]
|
||||
|
||||
class ModifyFile(BaseEvent, HasMetaData):
|
||||
|
|
Loading…
Reference in New Issue