Use normal header() calls instead of private method calls
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
b3ca73dc27
commit
70b1f510f2
6 changed files with 16 additions and 13 deletions
|
@ -41,7 +41,9 @@ $ftype=\OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesyst
|
|||
|
||||
header('Content-Type:'.$ftype);
|
||||
OCP\Response::setContentDispositionHeader(basename($filename), 'attachment');
|
||||
OCP\Response::disableCaching();
|
||||
header('Pragma: public');// enable caching in IE
|
||||
header('Expires: 0');
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
OCP\Response::setContentLengthHeader(\OC\Files\Filesystem::filesize($filename));
|
||||
|
||||
OC_Util::obEnd();
|
||||
|
|
|
@ -49,7 +49,9 @@ $ftype = \OC::$server->getMimeTypeDetector()->getSecureMimeType($view->getMimeTy
|
|||
|
||||
header('Content-Type:'.$ftype);
|
||||
OCP\Response::setContentDispositionHeader(basename($filename), 'attachment');
|
||||
OCP\Response::disableCaching();
|
||||
header('Pragma: public');// enable caching in IE
|
||||
header('Expires: 0');
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
OCP\Response::setContentLengthHeader($view->filesize($versionName));
|
||||
|
||||
OC_Util::obEnd();
|
||||
|
|
|
@ -146,6 +146,8 @@ class DeprecationCheck extends AbstractCheck {
|
|||
'OCP\IServerContainer::getDb' => '8.1.0',
|
||||
'OCP\IServerContainer::getHTTPHelper' => '8.1.0',
|
||||
|
||||
'OCP\Response::disableCaching' => '14.0.0',
|
||||
|
||||
'OCP\User::getUser' => '8.0.0',
|
||||
'OCP\User::getUsers' => '8.1.0',
|
||||
'OCP\User::getDisplayName' => '8.1.0',
|
||||
|
|
|
@ -75,7 +75,9 @@ class OC_Files {
|
|||
private static function sendHeaders($filename, $name, array $rangeArray) {
|
||||
OC_Response::setContentDispositionHeader($name, 'attachment');
|
||||
header('Content-Transfer-Encoding: binary', true);
|
||||
OC_Response::disableCaching();
|
||||
header('Pragma: public');// enable caching in IE
|
||||
header('Expires: 0');
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
$fileSize = \OC\Files\Filesystem::filesize($filename);
|
||||
$type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename));
|
||||
if ($fileSize > -1) {
|
||||
|
|
|
@ -55,7 +55,7 @@ class OC_Response {
|
|||
header('Cache-Control: max-age='.$cache_time.', must-revalidate');
|
||||
}
|
||||
else {
|
||||
self::setExpiresHeader(0);
|
||||
header('Expires: 0');
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
}
|
||||
}
|
||||
|
@ -66,14 +66,6 @@ class OC_Response {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* disable browser caching
|
||||
* @see enableCaching with cache_time = 0
|
||||
*/
|
||||
static public function disableCaching() {
|
||||
self::enableCaching(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set response status
|
||||
* @param int $status a HTTP status code, see also the STATUS constants
|
||||
|
|
|
@ -89,9 +89,12 @@ class Response {
|
|||
* Disable browser caching
|
||||
* @see enableCaching with cache_time = 0
|
||||
* @since 4.0.0
|
||||
* @deprecated 14.0.0 just set the headers
|
||||
*/
|
||||
static public function disableCaching() {
|
||||
\OC_Response::disableCaching();
|
||||
header('Pragma: public');// enable caching in IE
|
||||
header('Expires: 0');
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue