Operation postMediaCacheConfigAdv

Adds an advanced MediaCache configuration.

@param string $serverName Reserved for future use (required)
@param MediaCacheConfigAdv $body  (required)

@return void
@throws ApiException on non-2xx response
350090
public function postMediaCacheConfigAdv($serverName, $body)
    {
        list($response) = $this->postMediaCacheConfigAdvWithHttpInfo($serverName, $body);
        return $response;
    }
778946
public function addServer(string $hostname, Server $server)
    {
        if (isset($this->servers[$hostname])) {
            throw ClusterException::serverHostnameDuplicate($hostname);
        }

        $this->servers[$hostname] = $server;
    }
221755
public function putServerLicensesConfig($serverName, $body)
    {
        list($response) = $this->putServerLicensesConfigWithHttpInfo($serverName, $body);
        return $response;
    }
877112
public static function serve($filename, $contentType, $options)
    {
        $options = array_merge(self::$defaultOptions, $options);

        if ($options['set-last-modified-header'] === true) {
            Header::setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", @filemtime($filename)) ." GMT");
        }

        if ($options['set-content-type-header'] === true) {
            Header::setHeader('Content-type: ' . $contentType);
        }

        if ($options['add-vary-accept-header'] === true) {
            Header::addHeader('Vary: Accept');
        }

        if ($options['set-cache-control-header'] === true) {
            if (!empty($options['cache-control-header'])) {
                Header::setHeader('Cache-Control: ' . $options['cache-control-header']);

                // Add exprires header too (#126)
                // Check string for something like this: max-age:86400
                if (preg_match('#max-age\\s*=\\s*(\\d*)#', $options['cache-control-header'], $matches)) {
                    $seconds = $matches[1];
                    Header::setHeader('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + intval($seconds)));
                }
            }
        }

        if (@readfile($filename) === false) {
            Header::addHeader('X-WebP-Convert-Error: Could not read file');
            throw new ServeFailedException('Could not read file');
        }
    }
506458
public function postMediaCacheSourcesConfig3($serverName, $body)
    {
        list($response) = $this->postMediaCacheSourcesConfig3WithHttpInfo($serverName, $body);
        return $response;
    }
1100119
def __ConfigureMediaRequest(self, http_request):
        """"""
        http_request.headers['content-type'] = self.mime_type
        http_request.body = self.stream.read()
        http_request.loggable_body = '<media body>'
202946
public function setBody($body, $contentType = null)
    {
        if ($body !== $this->body) {
            $this->clearCache();
        }

        $this->body = $body;
        if (null !== $contentType) {
            $this->setContentType($contentType);
        }

        return $this;
    }
273506
public function getMediaCacheStoreList($serverName, $vhostName)
    {
        list($response) = $this->getMediaCacheStoreListWithHttpInfo($serverName, $vhostName);
        return $response;
    }
1021683
public function deleteUserConfig($serverName, $userName)
    {
        list($response) = $this->deleteUserConfigWithHttpInfo($serverName, $userName);
        return $response;
    }
636351
public function addPGPSignature($body, $algorithm = null)
    {
        $this->signature = $body;
        $this->micalg    = $algorithm;

        // Reset Content-Type to be overwritten with valid boundary
        unset($this->headers['Content-Type']);
        unset($this->headers['Content-Transfer-Encoding']);
    }
657109
public function putMediaCacheConfig($serverName, $body)
    {
        list($response) = $this->putMediaCacheConfigWithHttpInfo($serverName, $body);
        return $response;
    }
293800
private static void register(ObjectName objectName, Object mbean) {
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    try {
      if (!server.isRegistered(objectName)) {
        server.registerMBean(mbean, objectName);
      }
    } catch (InstanceAlreadyExistsException
        | MBeanRegistrationException | NotCompliantMBeanException e) {
      throw new CacheException("Error registering " + objectName, e);
    }
  }
430022
protected function handleWriteMedium(Request $request, MediaInterface $media, MediaProviderInterface $provider)
    {
        $form = $this->formFactory->createNamed(null, 'sonata_media_api_form_media', $media, [
            'provider_name' => $provider->getName(),
            'csrf_protection' => false,
        ]);

        $form->handleRequest($request);

        if ($form->isValid()) {
            $media = $form->getData();
            $this->mediaManager->save($media);

            $context = new Context();
            $context->setGroups(['sonata_api_read']);
            $context->enableMaxDepth();

            $view = FOSRestView::create($media);
            $view->setContext($context);

            return $view;
        }

        return $form;
    }
1103505
protected function sendBody($body):void
    {
        if (is_resource($body)) {
            fpassthru($body);
            fclose($body);
        }
        else {
            echo $body;
        }
    }
231716
public function setMetadata($key, $content)
    {
        $this->init();
        list($containerName, $key) = $this->tokenizeKey($key);

        try {
            $this->blobProxy->setBlobMetadata($containerName, $key, $content);
        } catch (ServiceException $e) {
            $errorCode = $this->getErrorCodeFromServiceException($e);

            throw new \RuntimeException(sprintf(
                'Failed to set metadata for blob "%s" in container "%s": %s (%s).',
                $key,
                $containerName,
                $e->getErrorText(),
                $errorCode
            ), $e->getCode());
        }
    }
153703
public function deletePublisherConfig3($serverName, $publisher)
    {
        list($response) = $this->deletePublisherConfig3WithHttpInfo($serverName, $publisher);
        return $response;
    }
9836
protected void setServerName(String serverName) {

        if (CmsStringUtil.isEmpty(serverName) || (WILDCARD.equals(serverName))) {
            m_serverName = WILDCARD;
        } else {
            m_serverName = serverName.trim();
        }
    }