Merge pull request #4349 from owncloud/oc_cache_fix

oc_cache needs to disable file proxys for read/write operation.
This commit is contained in:
Björn Schießle 2013-08-08 08:19:14 -07:00
commit c24bf47db8
1 changed files with 12 additions and 4 deletions

16
lib/cache/file.php vendored
View File

@ -29,22 +29,30 @@ class OC_Cache_File{
}
public function get($key) {
$result = null;
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
if ($this->hasKey($key)) {
$storage = $this->getStorage();
return $storage->file_get_contents($key);
$result = $storage->file_get_contents($key);
}
return null;
\OC_FileProxy::$enabled = $proxyStatus;
return $result;
}
public function set($key, $value, $ttl=0) {
$storage = $this->getStorage();
$result = false;
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
if ($storage and $storage->file_put_contents($key, $value)) {
if ($ttl === 0) {
$ttl = 86400; // 60*60*24
}
return $storage->touch($key, time() + $ttl);
$result = $storage->touch($key, time() + $ttl);
}
return false;
\OC_FileProxy::$enabled = $proxyStatus;
return $result;
}
public function hasKey($key) {