public function put($data)
 {
     if ($data == NULL) {
         Logging::logDebug("Ignoring empty update");
         return;
     }
     checkUploadSize();
     $oldSize = $this->file->exists() ? $this->file->size() : NULL;
     $size = isset($_SERVER['CONTENT_LENGTH']) ? $_SERVER['CONTENT_LENGTH'] : NULL;
     Logging::logDebug("Update " . $size);
     if ($size == 0) {
         Logging::logDebug("Ignoring empty update");
         return;
     }
     try {
         $this->env->filesystem()->updateFileContents($this->file, $data, $size);
     } catch (Exception $e) {
         Logging::logException($e);
         if ($oldSize != 0 and $this->env->request()->isWindowsClient()) {
             // windows tries to clean up interrupted overwrite
             // for existing files this is not acceptable, ignore later delete request
             Logging::logDebug("File update failed, marking delete ignore");
             $this->env->session()->setValue("ignore_delete_" . $this->file->id(), "" . time());
         }
         throw new Sabre_DAV_Exception_Forbidden();
     }
 }
Beispiel #2
0
 public function put($data)
 {
     if ($data != NULL) {
         checkUploadSize();
     }
     $this->controller->updateFileContents($this->file, $data);
 }