/**
  * @see	\wcf\data\DatabaseObjectList::readObjects()
  */
 public function readObjects()
 {
     parent::readObjects();
     $fileIDs = array();
     foreach ($this->objects as $file) {
         if ($file->isDeleted) {
             $fileIDs[] = $file->fileID;
         }
     }
     if (!empty($fileIDs)) {
         $this->logList = new EntryFileModificationLogList();
         $this->logList->setEntryFileData($fileIDs, 'trash');
         $this->logList->readObjects();
         foreach ($this->logList->getObjects() as $logEntry) {
             $this->objects[$logEntry->objectID]->setLogEntry($logEntry);
         }
     }
 }
 /**
  * Moves given files into trash bin.
  */
 public function trash()
 {
     $ignoreEntries = isset($this->parameters['ignoreEntries']) && $this->parameters['ignoreEntries'];
     $entryIDs = array();
     foreach ($this->getObjects() as $file) {
         if (!isset($entryIDs[$file->entryID])) {
             $entryIDs[$file->entryID] = $file->entryID;
         }
     }
     $fileStats = [];
     if (!$ignoreEntries) {
         $fileStats = $this->getDetailedFileStats($entryIDs);
     }
     // update entries
     $files = $disableEntries = $trashEntries = $entryIDs = $fileIDs = array();
     foreach ($this->getObjects() as $file) {
         $files[$file->fileID] = $file;
         // ignore files which are already in trash bin
         if ($file->isDeleted) {
             continue;
         }
         $entryEditor = new EntryEditor($file->getEntry());
         $fileIDs[] = $file->fileID;
         if (!$ignoreEntries) {
             if (!$file->isDisabled) {
                 $fileStats[$file->entryID]['files']--;
                 $fileStats[$file->entryID]['visibleFiles']--;
             } else {
                 $fileStats[$file->entryID]['disabledFiles']--;
             }
             // no more visible files
             if (!$fileStats[$file->entryID]['visibleFiles']) {
                 if ($fileStats[$file->entryID]['disabledFiles']) {
                     // entry has disabled files thus disable
                     // entry
                     $disableEntries[] = $entryEditor;
                     $this->addEntryData($entryEditor->entryID, 'isDisabled', 1);
                 } else {
                     // entry only has deleted files anymore
                     // thus trash it
                     $trashEntries[] = $entryEditor;
                     $this->addEntryData($entryEditor->entryID, 'isDeleted', 1);
                 }
             }
         }
         $file->update(array('deleteTime' => TIME_NOW, 'isDeleted' => 1));
         FileModificationLogHandler::getInstance()->trash($file->getDecoratedObject(), !empty($this->parameters['data']['reason']) ? $this->parameters['data']['reason'] : '');
         $this->addFileData($file->getDecoratedObject(), 'isDeleted', 1);
     }
     // get delete notes
     if (!empty($fileIDs)) {
         $logList = new EntryFileModificationLogList();
         $logList->setEntryFileData($fileIDs, 'trash');
         $logList->getConditionBuilder()->add('modification_log.time = ?', array(TIME_NOW));
         $logList->readObjects();
         $logEntries = array();
         foreach ($logList as $logEntry) {
             $logEntry->setFile($files[$logEntry->objectID]->getDecoratedObject());
             $logEntries[$logEntry->objectID] = $logEntry;
         }
         foreach ($this->getObjects() as $file) {
             if (isset($logEntries[$file->fileID])) {
                 $viewableFile = new ViewableEntryFile($file->getDecoratedObject());
                 $viewableFile->setLogEntry($logEntries[$file->fileID]);
                 $this->addFileData($file->getDecoratedObject(), 'deleteNote', WCF::getLanguage()->getDynamicVariable('filebase.entry.file.deleted', ['file' => $viewableFile]));
             }
         }
     }
     if (!empty($entryIDs)) {
         EntryEditor::rebuildEntryData($entryIDs);
     }
     // disable entries with no more visible files but which still have
     // disabled files
     if (!$ignoreEntries && !empty($disableEntries)) {
         $entryAction = new EntryAction($disableEntries, 'disable', array('ignoreFiles' => true));
         $entryAction->executeAction();
     }
     // trash entries with no more visible files
     if (!$ignoreEntries && !empty($trashEntries)) {
         $entryAction = new EntryAction($trashEntries, 'trash', array('ignoreFiles' => true, 'data' => array('reason' => !empty($this->parameters['data']['reason']) ? $this->parameters['data']['reason'] : '')));
         $entryAction->executeAction();
     }
     $this->unmarkItems($entryIDs);
     return $this->getFileData();
 }