/** * * Physically delete the file in $sharedPhysicalFilePath and change the $dropFolderFile status to KalturaDropFolderFileStatus::PURGED * @param KalturaDropFolderFile $dropFolderFile * @param string $sharedPhysicalFilePath */ private function purgeFile(KalturaDropFolderFile $dropFolderFile, $physicalFilePath) { // physicaly delete the file $delResult = null; try { $delResult = $this->fileTransferMgr->delFile($physicalFilePath); } catch (Exception $e) { $this->unimpersonate(); KalturaLog::err('Cannot delete physical file [' . $physicalFilePath . '] for drop folder file id [' . $dropFolderFile->id . '] - ' . $e->getMessage()); return false; } if (!$delResult) { KalturaLog::err("Cannot delete physical file at path [{$physicalFilePath}]"); try { $this->impersonate($dropFolderFile->partnerId); $this->dropFolderPlugin->dropFolderFile->updateStatus($dropFolderFile->id, KalturaDropFolderFileStatus::ERROR_DELETING); $this->unimpersonate(); } catch (Exception $e) { $this->unimpersonate(); KalturaLog::err('Cannot update status for drop folder file id [' . $dropFolderFile->id . '] - ' . $e->getMessage()); } return false; } // change status to PURGED return $this->setFileAsPurged($dropFolderFile); }
protected function purgeFile(KalturaDropFolderFile $dropFolderFile) { $fullPath = $this->dropFolder->path . '/' . $dropFolderFile->fileName; // physicaly delete the file $delResult = null; try { $delResult = $this->fileTransferMgr->delFile($fullPath); } catch (Exception $e) { KalturaLog::err("Error when deleting drop folder file - " . $e->getMessage()); $delResult = null; } if (!$delResult) { $this->handleFileError($dropFolderFile->id, KalturaDropFolderFileStatus::ERROR_DELETING, KalturaDropFolderFileErrorCode::ERROR_DELETING_FILE, DropFolderPlugin::ERROR_DELETING_FILE_MESSAGE . '[' . $fullPath . ']'); } else { $this->handleFilePurged($dropFolderFile->id); } }
/** * Tests kFileTransferMgr->delFile() */ public function testDelFile() { // TODO Auto-generated kFileTransferMgrTest->testDelFile() $this->markTestIncomplete("delFile test not implemented"); $this->kFileTransferMgr->delFile(); }