fix for Allowed memory size of xx bytes exhausted while reading big files

This commit is contained in:
Florin Peter 2013-05-14 22:32:39 +02:00
parent 84c56a5d56
commit 0a7aa6e8cd
1 changed files with 12 additions and 5 deletions

View File

@ -480,13 +480,20 @@ class Util {
*/ */
public function isEncryptedPath( $path ) { public function isEncryptedPath( $path ) {
// Disable encryption proxy so data retreived is in its // Disable encryption proxy so data retrieved is in its
// original form // original form
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false; \OC_FileProxy::$enabled = false;
$data = $this->view->file_get_contents( $path ); // we only need 24 byte from the last chunk
$data = '';
$handle = $this->view->fopen( $path, 'r' );
if(!fseek($handle, -24, SEEK_END)) {
$data = fgets($handle);
}
\OC_FileProxy::$enabled = true; // re-enable proxy
\OC_FileProxy::$enabled = $proxyStatus;
return Crypt::isCatfileContent( $data ); return Crypt::isCatfileContent( $data );