summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-22 15:35:35 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-02-19 09:40:25 +0100
commit70b1f510f2eab2276beab2e0b47d08f04c63c966 (patch)
tree9bea5016d93081f747238baed4bc93d40a8e5eed
parentb3ca73dc277f7c5b00f2175d5c42919f044631c0 (diff)
downloadnextcloud-server-70b1f510f2eab2276beab2e0b47d08f04c63c966.tar.gz
nextcloud-server-70b1f510f2eab2276beab2e0b47d08f04c63c966.zip
Use normal header() calls instead of private method calls
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r--apps/files/download.php4
-rw-r--r--apps/files_versions/download.php4
-rw-r--r--lib/private/App/CodeChecker/DeprecationCheck.php2
-rw-r--r--lib/private/legacy/files.php4
-rw-r--r--lib/private/legacy/response.php10
-rw-r--r--lib/public/Response.php5
6 files changed, 16 insertions, 13 deletions
diff --git a/apps/files/download.php b/apps/files/download.php
index 60f386f50f0..2389c9b535e 100644
--- a/apps/files/download.php
+++ b/apps/files/download.php
@@ -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();
diff --git a/apps/files_versions/download.php b/apps/files_versions/download.php
index e5c70dd2bc5..833077fbcce 100644
--- a/apps/files_versions/download.php
+++ b/apps/files_versions/download.php
@@ -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();
diff --git a/lib/private/App/CodeChecker/DeprecationCheck.php b/lib/private/App/CodeChecker/DeprecationCheck.php
index c337e71f27e..722697f3313 100644
--- a/lib/private/App/CodeChecker/DeprecationCheck.php
+++ b/lib/private/App/CodeChecker/DeprecationCheck.php
@@ -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',
diff --git a/lib/private/legacy/files.php b/lib/private/legacy/files.php
index 24324bca095..def9f82fab9 100644
--- a/lib/private/legacy/files.php
+++ b/lib/private/legacy/files.php
@@ -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) {
diff --git a/lib/private/legacy/response.php b/lib/private/legacy/response.php
index 975ff570485..1b0b01de972 100644
--- a/lib/private/legacy/response.php
+++ b/lib/private/legacy/response.php
@@ -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");
}
}
@@ -67,14 +67,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
*/
diff --git a/lib/public/Response.php b/lib/public/Response.php
index dd029e12dbf..dbd506d379d 100644
--- a/lib/public/Response.php
+++ b/lib/public/Response.php
@@ -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");
}
/**