Ejemplo n.º 1
0
 public function updateFileContents($item, $content, $size = 0)
 {
     if (!$item->isFile()) {
         throw new ServiceException("NOT_A_FILE", $item->path());
     }
     $this->validateAction(FileEvent::UPDATE_CONTENT, $item, array("size" => $size));
     if ($this->triggerActionInterceptor(FileEvent::UPDATE_CONTENT, $item, array("name" => $item->name(), "target" => $item, "size" => $size))) {
         return;
     }
     Logging::logDebug('updating file contents [' . $item->id() . ']');
     $this->assertRights($item, self::PERMISSION_LEVEL_READWRITE, "update content");
     $item->put($content);
     $this->env->events()->onEvent(FileEvent::updateContent($item));
 }