Exemplo n.º 1
0
 public function output($files, $cache_key)
 {
     header('Content-Type: ' . $this->contentType);
     OC_Response::enableCaching();
     $etag = $this->generateETag($files);
     $cache_key .= '-' . $etag;
     $gzout = false;
     $cache = OC_Cache::getGlobalCache();
     if (!OC_Request::isNoCache() && (!defined('DEBUG') || !DEBUG)) {
         OC_Response::setETagHeader($etag);
         $gzout = $cache->get($cache_key . '.gz');
     }
     if (!$gzout) {
         $out = $this->minimizeFiles($files);
         $gzout = gzencode($out);
         $cache->set($cache_key . '.gz', $gzout);
         OC_Response::setETagHeader($etag);
     }
     if ($encoding = OC_Request::acceptGZip()) {
         header('Content-Encoding: ' . $encoding);
         $out = $gzout;
     } else {
         $out = gzdecode($gzout);
     }
     header('Content-Length: ' . strlen($out));
     echo $out;
 }