Пример #1
0
 /**
  * {@inheritDoc}
  */
 public function update($primaryKey, $values)
 {
     $this->mapPrimaryKey($primaryKey);
     $path = $this->getPathFromPK($primaryKey);
     $this->webFilesystem->write($path, $values['content']);
     return parent::update($primaryKey, $values);
 }
Пример #2
0
 /**
  * @ApiDoc(
  *  section="File Manager",
  *  description="Saves the file content"
  * )
  *
  * @Rest\RequestParam(name="path", requirements=".+", strict=true, description="The file path or its ID")
  * @Rest\RequestParam(name="contentEncoding", requirements="plain|base64", default="plain", description="The $content contentEncoding.")
  * @Rest\RequestParam(name="content", description="The file content")
  *
  * @Rest\Post("/admin/file/content")
  *
  * @param ParamFetcher $paramFetcher
  *
  * @return bool
  */
 public function setContentAction(ParamFetcher $paramFetcher)
 {
     $path = $paramFetcher->get('path');
     $content = $paramFetcher->get('content');
     $contentEncoding = $paramFetcher->get('contentEncoding');
     $this->checkAccess($path);
     if ('base64' === $contentEncoding) {
         $content = base64_decode($content);
     }
     if ($result = $this->webFilesystem->write($path, $content)) {
         $this->newFeed($path, 'changed content of');
     }
     return $result;
 }