Saves the file
Note: it is supported to update the existing file only. For adding a new file see FileCollection.add method
@param ClientRuntimeContext $ctx
@param string $serverRelativeUrl
@param string $content file content
@throws \Exception
504053
public static function saveBinary(ClientRuntimeContext $ctx, $serverRelativeUrl, $content)
    {
        $serverRelativeUrl = rawurlencode($serverRelativeUrl);
        $url = $ctx->getServiceRootUrl() . "web/getfilebyserverrelativeurl('$serverRelativeUrl')/\$value";
        $request = new RequestOptions($url);
        $request->Method = HttpMethod::Post;
        $request->addCustomHeader('X-HTTP-Method', 'PUT');
        $request->Data = $content;
        if ($ctx instanceof ClientContext) {
            $ctx->ensureFormDigest($request);
        }
        $ctx->executeQueryDirect($request);
    }
928197
public void saveReplyDestination(Message receivedMessage, TestContext context) {
        if (receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS) != null) {
            String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
            String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage);
            correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context);
            correlationManager.store(correlationKey, receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS).toString());
        }  else {
            log.warn("Unable to retrieve reply address for message \n" +
                    receivedMessage + "\n - no reply address found in message headers!");
        }
    }
890378
public function update($filename, $content)
    {
        if ($this->exists($filename) && $this->isFile($filename)) {
            return $this->create($filename, $content);
        }

        throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
    }
1258460
public static void updateFileFromUrl(final String sourceUrl, final String destinationFilePath) throws
        UpdateException {
        updateFileFromUrl(sourceUrl, destinationFilePath, null, null);
    }
352720
function (content) {
      var fileContent = self._readFileSync();

      fileContent.instances = fileContent.instances || {};
      fileContent.instances[this._id] = content;
      self._writeFileSync(fileContent);
    }
726130
protected function uploadStringToGoogleDrive($contents, $parentId, $fileName, $srcDriveFile, $mime)
    {
        return $this->ensureDriveFileExists($contents, $parentId, $fileName, $srcDriveFile, $mime);
    }
1333060
protected function doAddContentFolder($contentFolder)
    {
        parent::doAddContentFolder($contentFolder);

        $contentFolderPosition = ContentFolderQuery::create()
            ->filterByFolderId($contentFolder->getFolderId())
            ->orderByPosition(Criteria::DESC)
            ->findOne();

        $contentFolder->setPosition($contentFolderPosition !== null ? $contentFolderPosition->getPosition() + 1 : 1);
    }
846089
private void doUpdateJavaCFX() throws PageException {
	String name = getString("admin", action, "name");
	if (StringUtil.startsWithIgnoreCase(name, "cfx_")) name = name.substring(4);
	lucee.runtime.db.ClassDefinition cd = new ClassDefinitionImpl(getString("admin", action, "class"), getString("bundleName", null), getString("bundleVersion", null),
		config.getIdentification());
	admin.updateJavaCFX(name, cd);
	store();
	adminSync.broadcast(attributes, config);
    }
421736
public static function put(string $filepath, string $content):int
    {
        if (!file_exists($filepath)) {
            Server::create($filepath, "file");
        }
        file_put_contents($filepath, $content);
        self::open($filepath);
        return (1);
    }
658264
function (content) {
      var fileContent = self._readFileSync();

      fileContent.instances = fileContent.instances || {};
      fileContent.instances[this._id] = _.assign(fileContent.instances[this._id] || {}, content);
      self._writeFileSync(fileContent);
    }
544209
public function saveContentToFile($filePath, $content)
	{
		return $this->s3Client->putObject([
			'Bucket' => $this->getBucket(),
			'Key' => $filePath,
			'Body' => $content
		]);
	}
762232
protected function saveToFile(string $content, PhingFile $destination): void
    {
        $path = $destination->getPath();
        $this->log("Writing: $path", Project::MSG_INFO);

        (new FileWriter($destination))->write($content);
    }
1325918
private function saveFile($file, $content, $time)
    {
        // create directory if not exists
        if (!is_dir($dir = dirname($file))) {
            // @codeCoverageIgnoreStart
            if (!make_dir($dir, 0775)) {
                throw new RuntimeException(sprintf('View Template Engine was not able to create directory "%s"', $dir)); // @codeCoverageIgnore
            }
            // @codeCoverageIgnoreEnd
        } // @codeCoverageIgnore

        // save file
        if (file_exists($file)) {
            unlink($file); // so we will to be the owner at the new file
        }

        if (file_put_contents($file, $content, LOCK_EX) === false) {
            throw new RuntimeException(sprintf('View Template Engine was not able to save file "%s"', $file)); // @codeCoverageIgnore
        }

        @chmod($file, 0664);

        // set file modification time
        if (!@touch($file, $time)) {
            throw new RuntimeException(sprintf('View Template Engine was not able to modify time of file "%s"', $file)); // @codeCoverageIgnore
        }
    }
171231
public function addToContentType($fieldName, ContentType $contentType)
    {
        try {
            $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentType->id);
        } catch (NotFoundException $e) {
            $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType);
        }

        $typeUpdate = $this->contentTypeService->newContentTypeUpdateStruct();
        $typeUpdate->modificationDate = new DateTime();

        $knowLanguage = array_keys($contentType->getDescriptions());

        if (!in_array($contentType->mainLanguageCode, $knowLanguage)) {
            $knowLanguage[] = $contentType->mainLanguageCode;
        }

        $fieldCreateStruct = $this->contentTypeService->newFieldDefinitionCreateStruct(
            $fieldName,
            'novaseometas'
        );

        $fieldCreateStruct->names = array_fill_keys($knowLanguage, $this->metaFieldName);
        $fieldCreateStruct->descriptions = array_fill_keys($knowLanguage, $this->metaFieldDescription);
        $fieldCreateStruct->fieldGroup = $this->metaFieldGroup;
        $fieldCreateStruct->position = 100;
        $fieldCreateStruct->isTranslatable = true;
        $fieldCreateStruct->isRequired = false;
        $fieldCreateStruct->isSearchable = false;
        $fieldCreateStruct->isInfoCollector = false;

        try {
            $this->contentTypeService->updateContentTypeDraft($contentTypeDraft, $typeUpdate);

            if ($contentTypeDraft->getFieldDefinition($fieldName) == null) {
                $this->contentTypeService->addFieldDefinition($contentTypeDraft, $fieldCreateStruct);
            }

            $this->contentTypeService->publishContentTypeDraft($contentTypeDraft);

            return true;
        } catch (Exception $e) {
            $this->errorMessage = $e->getMessage();

            return false;
        }
    }
172691
public function addPostFile($key, $file, $content = null)
    {
        $this->setMethod('POST');
        $this->setBody(null);
        if ($content === null && is_file($file)) {
            $content = @file_get_contents($file);
        }
        $this->_postFiles[$key] = [basename($file), $content];
    }
816556
public function writeFile(
        string $content,
        string $filename,
        string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING,
        ?ErrorCorrectionLevel $ecLevel = null
    ) : void {
        file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel));
    }
1173916
public void saveContent(
        JavaScriptObject newValues,
        final I_CmsStringCallback onSuccess,
        final I_CmsErrorCallback onFailure) {

        m_apiRoot.getRpcHelper().executeRpc(
            CmsXmlContentUgcApi.SERVICE.saveContent(
                m_content.getSessionId(),
                CmsJsUtils.convertJsObjectToMap(newValues),
                new AsyncCallback<Map<String, String>>() {

                    @SuppressWarnings("synthetic-access")
                    public void onFailure(Throwable caught) {

                        CmsUgcException formException = (CmsUgcException)caught;
                        m_apiRoot.handleError(formException, onFailure);
                    }

                    public void onSuccess(Map<String, String> result) {

                        if ((result == null) || result.isEmpty()) {
                            onSuccess.call("");
                        } else {
                            JavaScriptObject validationErrorsJso = CmsJsUtils.convertMapToJsObject(result);
                            onFailure.call(CmsUgcConstants.ErrorCode.errValidation.toString(), "", validationErrorsJso);
                        }
                    }
                }));

    }