本文整理匯總了PHP中Sonata\MediaBundle\Model\MediaInterface::getCdnIsFlushable方法的典型用法代碼示例。如果您正苦於以下問題:PHP MediaInterface::getCdnIsFlushable方法的具體用法?PHP MediaInterface::getCdnIsFlushable怎麽用?PHP MediaInterface::getCdnIsFlushable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sonata\MediaBundle\Model\MediaInterface
的用法示例。
在下文中一共展示了MediaInterface::getCdnIsFlushable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: flushCdn
/**
* @param MediaInterface $media
*/
public function flushCdn(MediaInterface $media)
{
if ($media->getId() && $this->requireThumbnails() && !$media->getCdnIsFlushable()) {
$flushPaths = array();
foreach ($this->getFormats() as $format => $settings) {
if ('admin' === $format || substr($format, 0, strlen($media->getContext())) === $media->getContext()) {
$flushPaths[] = $this->getFilesystem()->get($this->generatePrivateUrl($media, $format), true)->getKey();
}
}
if (!empty($flushPaths)) {
$cdnFlushIdentifier = $this->getCdn()->flushPaths($flushPaths);
$media->setCdnFlushIdentifier($cdnFlushIdentifier);
$media->setCdnIsFlushable(true);
$media->setCdnStatus(CDNInterface::STATUS_TO_FLUSH);
}
}
}
示例2: generatePublicUrl
/**
* @param \Sonata\MediaBundle\Model\MediaInterface $media
* @param string $format
* @return string
*/
public function generatePublicUrl(MediaInterface $media, $format)
{
// todo: add a valid icon set
return $this->getCdn()->getPath(sprintf('media_bundle/images/files/%s/file.png', $format), $media->getCdnIsFlushable());
}
示例3: generateProtectedUrl
/**
* @param MediaInterface $media
*
* @return string
* @internal param $format
*/
public function generateProtectedUrl(MediaInterface $media)
{
return $this->getCdn()->getPath($media->getId(), $media->getCdnIsFlushable());
}