/** * Stash the file and return the file key * Also re-raises exceptions with slightly more informative message strings (useful for API) * @throws MWException * @return String file key */ function performStash() { try { $fileKey = $this->mUpload->stashFile()->getFileKey(); } catch (MWException $e) { $message = 'Stashing temporary file failed: ' . get_class($e) . ' ' . $e->getMessage(); wfDebug(__METHOD__ . ' ' . $message . "\n"); throw new MWException($message); } return $fileKey; }
/** * Stash the file and return the file key * Also re-raises exceptions with slightly more informative message strings (useful for API) * @throws MWException * @return string File key */ private function performStash() { try { $stashFile = $this->mUpload->stashFile($this->getUser()); if (!$stashFile) { throw new MWException('Invalid stashed file'); } $fileKey = $stashFile->getFileKey(); } catch (Exception $e) { $message = 'Stashing temporary file failed: ' . get_class($e) . ' ' . $e->getMessage(); wfDebug(__METHOD__ . ' ' . $message . "\n"); $className = get_class($e); throw new $className($message); } return $fileKey; }
/** * Stash the file. * * @param User $user * @return UploadStashFile */ public function stashFile(User $user = null) { // replace mLocalFile with an instance of UploadStashFile, which adds some methods // that are useful for stashed files. $this->mLocalFile = parent::stashFile($user); return $this->mLocalFile; }
/** * There is no need to stash the image twice */ public function stashFile($key = null) { if (!empty($this->mLocalFile)) { return $this->mLocalFile; } return parent::stashFile($key); }