public function send404ImageNotFound()
 {
     $this->mSpecial->getOutput()->disable();
     # No HTML output
     StreamFile::prepareForStream(null, null, null, true);
     # send 404 Not Found
 }
示例#2
0
 /**
  * @see FileBackend::streamFile()
  * @return Status
  */
 public final function streamFile(array $params)
 {
     wfProfileIn(__METHOD__);
     wfProfileIn(__METHOD__ . '-' . $this->name);
     $status = Status::newGood();
     $info = $this->getFileStat($params);
     if (!$info) {
         // let StreamFile handle the 404
         $status->fatal('backend-fail-notexists', $params['src']);
     }
     // Set output buffer and HTTP headers for stream
     $extraHeaders = isset($params['headers']) ? $params['headers'] : array();
     $res = StreamFile::prepareForStream($params['src'], $info, $extraHeaders);
     if ($res == StreamFile::NOT_MODIFIED) {
         // do nothing; client cache is up to date
     } elseif ($res == StreamFile::READY_STREAM) {
         wfProfileIn(__METHOD__ . '-send');
         wfProfileIn(__METHOD__ . '-send-' . $this->name);
         $status = $this->doStreamFile($params);
         wfProfileOut(__METHOD__ . '-send-' . $this->name);
         wfProfileOut(__METHOD__ . '-send');
     } else {
         $status->fatal('backend-fail-stream', $params['src']);
     }
     wfProfileOut(__METHOD__ . '-' . $this->name);
     wfProfileOut(__METHOD__);
     return $status;
 }
 public final function streamFile(array $params)
 {
     $ps = Profiler::instance()->scopedProfileIn(__METHOD__ . "-{$this->name}");
     $status = Status::newGood();
     $info = $this->getFileStat($params);
     if (!$info) {
         // let StreamFile handle the 404
         $status->fatal('backend-fail-notexists', $params['src']);
     }
     // Set output buffer and HTTP headers for stream
     $extraHeaders = isset($params['headers']) ? $params['headers'] : array();
     $res = StreamFile::prepareForStream($params['src'], $info, $extraHeaders);
     if ($res == StreamFile::NOT_MODIFIED) {
         // do nothing; client cache is up to date
     } elseif ($res == StreamFile::READY_STREAM) {
         $status = $this->doStreamFile($params);
         if (!$status->isOK()) {
             // Per bug 41113, nasty things can happen if bad cache entries get
             // stuck in cache. It's also possible that this error can come up
             // with simple race conditions. Clear out the stat cache to be safe.
             $this->clearCache(array($params['src']));
             $this->deleteFileCache($params['src']);
             trigger_error("Bad stat cache or race condition for file {$params['src']}.");
         }
     } else {
         $status->fatal('backend-fail-stream', $params['src']);
     }
     return $status;
 }