/** * Offers the user to download the PDF-file * * @param numeric $pdfId the ID of the temporary file to download */ public function showPdfOfDeletedUser($pdfId) { try { $tmp = TemporaryFile::load($pdfId); $tmp->download("{$pdfId}Deleted.pdf", 'application/pdf'); } catch (Exception $e) { $this->_interface->showError('ein Fehler ist aufgetreten'); } }
/** * Removes Expired Temporary files * @return int The count of removed Entries */ protected static function removeExpired() { $now = self::toDatetime(time()); $oldEntries = TableMng::query("SELECT * FROM SystemTemporaryFiles WHERE until < '{$now}'"); $deletedEntries = 0; if (count($oldEntries)) { foreach ($oldEntries as $entry) { $temp = TemporaryFile::load($entry['ID']); $temp->remove(); $deletedEntries += 1; } } return $deletedEntries; }