/** * Check if all the files are finished upload * If yes return XML drop folder file instance * otherwise return false * @param DropFolderFile $file */ private function getXmlFileIfReadyForProcessing(DropFolderFile $file) { KalturaLog::debug('Check if file [' . $file->getId() . '] ready for processing '); if (!$file->getLeadDropFolderFileId()) { KalturaLog::debug('The XML file is not uploaded yet - changing status to WAITING'); return false; } $statuses = array(DropFolderFileStatus::PARSED, DropFolderFileStatus::UPLOADING, DropFolderFileStatus::DETECTED); $nonReadyFiles = DropFolderFilePeer::retrieveByLeadIdAndStatuses($file->getLeadDropFolderFileId(), $statuses); if ($nonReadyFiles && count($nonReadyFiles) > 0) { KalturaLog::debug('Not all the files finished uploading - changing status to WAITING'); return false; } $xmlFile = null; if ($file->getId() == $file->getLeadDropFolderFileId()) { $xmlFile = $file; } else { $xmlFile = DropFolderFilePeer::retrieveByPK($file->getLeadDropFolderFileId()); } return $xmlFile; }