Using stream_get_contents in file_get_contents implementation + close handle
This commit is contained in:
parent
ff16e3dbff
commit
8991272269
|
@ -112,24 +112,19 @@ class Encryption extends Wrapper {
|
||||||
*/
|
*/
|
||||||
public function file_get_contents($path) {
|
public function file_get_contents($path) {
|
||||||
|
|
||||||
$data = null;
|
|
||||||
$encryptionModule = $this->getEncryptionModule($path);
|
$encryptionModule = $this->getEncryptionModule($path);
|
||||||
|
|
||||||
if ($encryptionModule) {
|
if ($encryptionModule) {
|
||||||
|
$handle = $this->fopen($path, "r");
|
||||||
$handle = $this->fopen($path, 'r');
|
if (!$handle) {
|
||||||
|
return false;
|
||||||
if (is_resource($handle)) {
|
|
||||||
while (!feof($handle)) {
|
|
||||||
$data .= fread($handle, $this->util->getBlockSize());
|
|
||||||
}
|
}
|
||||||
}
|
$data = stream_get_contents($handle);
|
||||||
} else {
|
fclose($handle);
|
||||||
$data = $this->storage->file_get_contents($path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
return $this->storage->file_get_contents($path);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* see http://php.net/manual/en/function.file_put_contents.php
|
* see http://php.net/manual/en/function.file_put_contents.php
|
||||||
|
|
Loading…
Reference in New Issue