$data=substr($block,0,$currentPos%8192).$data;
fseek($this->source,-($currentPos%8192),SEEK_CUR);
}
- while(strlen($data)>0){
- if(strlen($data)<8192){
+ $currentPos=ftell($this->source);
+ while($remainingLength=strlen($data)>0){
+ if($remainingLength<8192){
$this->writeCache=$data;
$data='';
}else{
$data=substr($data,8192);
}
}
- $currentPos=ftell($this->source);
- $this->size=max($this->size,$currentPos);
+ $this->size=max($this->size,$currentPos+$length);
return $length;
}
$data=array_merge(OC_FileCache::$savedData[$path],$data);
unset(OC_FileCache::$savedData[$path]);
}
- if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
- self::$savedData[$path]=$data;
- return;
- }
if($id!=-1){
self::update($id,$data);
return;
}
+ if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
+ self::$savedData[$path]=$data;
+ return;
+ }
if(!isset($data['encrypted'])){
$data['encrypted']=false;
}