/**
  * Convert all drop folder files' status from PROCESSING to HANDLED/DELETED in case of DropFolderFileDeletePolicy::AUTO_DELETE_WHEN_ENTRY_IS_READY
  * 
  * Note that if the entry reached entryStatus::ERROR_CONVERTING, then the drop folder files' 
  * conversions already failed, so there's no need to change their status (thus they won't be handled here).  
  *  
  * @param entry $entry
  */
 private function onEntryStatusChanged($entry)
 {
     // Handle only files that are still in the PROCESSING state, which were left
     // in this state due to AUTO_DELETE_WHEN_ENTRY_IS_READY delete policy.
     $dropFolderFiles = DropFolderFilePeer::retrieveByEntryIdPartnerIdAndStatuses($entry->getId(), $entry->getPartnerId(), array(DropFolderFileStatus::PROCESSING));
     $dropFolderIdToDropFolderCache = array();
     $entryStatus = $entry->getStatus();
     foreach ($dropFolderFiles as $dropFolderFile) {
         $newDropFolderFileStatus = null;
         if ($entryStatus == entryStatus::ERROR_CONVERTING) {
             $newDropFolderFileStatus = DropFolderFileStatus::ERROR_HANDLING;
         } elseif ($entryStatus == entryStatus::READY) {
             // Get the associated drop folder
             $dropFolderId = $dropFolderFile->getDropFolderId();
             if (key_exists($dropFolderId, $dropFolderIdToDropFolderCache)) {
                 $dropFolder = $dropFolderIdToDropFolderCache[$dropFolderId];
             } else {
                 $dropFolder = DropFolderPeer::retrieveByPK($dropFolderId);
                 $dropFolderIdToDropFolderCache[$dropFolderId] = $dropFolder;
             }
             if ($dropFolder->getFileDeletePolicy() == DropFolderFileDeletePolicy::AUTO_DELETE_WHEN_ENTRY_IS_READY) {
                 if ($dropFolder->getAutoFileDeleteDays() == 0) {
                     $newDropFolderFileStatus = DropFolderFileStatus::DELETED;
                     // Mark for immediate deletion
                 } else {
                     $newDropFolderFileStatus = DropFolderFileStatus::HANDLED;
                 }
             }
         }
         KalturaLog::info("Entry id [{$entry->getId()}] status [{$entryStatus}], drop folder file id [{$dropFolderFile->getId()}] status [{$dropFolderFile->getStatus()}] => [" . ($newDropFolderFileStatus ? $newDropFolderFileStatus : "{$dropFolderFile->getStatus()} (unchanged)") . "]");
         if ($newDropFolderFileStatus) {
             $dropFolderFile->setStatus($newDropFolderFileStatus);
             $dropFolderFile->save();
         }
     }
 }