public function execute() { $out = $this->mSpecial->getOutput(); $dbr = wfGetDB(DB_SLAVE); $row = $dbr->selectRow('moderation', array('mod_user AS user', 'mod_user_text AS user_text', 'mod_title AS title', 'mod_stash_key AS stash_key'), array('mod_id' => $this->id), __METHOD__); if (!$row) { throw new ModerationError('moderation-edit-not-found'); } $user = $row->user ? User::newFromId($row->user) : User::newFromName($row->user_text, false); $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash($user); try { $file = $stash->getFile($row->stash_key); } catch (MWException $e) { return $this->send404ImageNotFound(); } $is_thumb = $this->mSpecial->getRequest()->getVal('thumb'); if ($is_thumb) { $thumb = $file->transform(array('width' => self::THUMB_WIDTH), File::RENDER_NOW); if ($thumb) { if ($thumb->fileIsSource()) { $is_thumb = false; } else { $file = new UnregisteredLocalFile(false, $stash->repo, $thumb->getStoragePath(), false); } } } if (!$file) { return $this->send404ImageNotFound(); } $thumb_filename = ''; if ($is_thumb) { $thumb_filename .= $file->getWidth() . 'px-'; } $thumb_filename .= $row->title; $headers = array(); $headers[] = "Content-Disposition: " . FileBackend::makeContentDisposition('inline', $thumb_filename); $out->disable(); # No HTML output (image only) $file->getRepo()->streamFile($file->getPath(), $headers); }