当前位置: 首页>>代码示例>>PHP>>正文


PHP Version::disable方法代码示例

本文整理汇总了PHP中Pimcore\Model\Version::disable方法的典型用法代码示例。如果您正苦于以下问题:PHP Version::disable方法的具体用法?PHP Version::disable怎么用?PHP Version::disable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Model\Version的用法示例。


在下文中一共展示了Version::disable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // disable versioning
     Version::disable();
     // get all thumbnails
     $dir = Asset\Video\Thumbnail\Config::getWorkingDir();
     $thumbnails = array();
     $files = scandir($dir);
     foreach ($files as $file) {
         if (strpos($file, ".xml")) {
             $thumbnails[] = str_replace(".xml", "", $file);
         }
     }
     $allowedThumbs = array();
     if ($input->getOption("thumbnails")) {
         $allowedThumbs = explode(",", $input->getOption("thumbnails"));
     }
     // get only images
     $conditions = array("type = 'video'");
     if ($input->getOption("parent")) {
         $parent = Asset::getById($input->getOption("parent"));
         if ($parent instanceof Asset\Folder) {
             $conditions[] = "path LIKE '" . $parent->getFullPath() . "/%'";
         } else {
             $this->writeError($input->getOption("parent") . " is not a valid asset folder ID!");
             exit;
         }
     }
     $list = new Asset\Listing();
     $list->setCondition(implode(" AND ", $conditions));
     $total = $list->getTotalCount();
     $perLoop = 10;
     for ($i = 0; $i < ceil($total / $perLoop); $i++) {
         $list->setLimit($perLoop);
         $list->setOffset($i * $perLoop);
         $videos = $list->load();
         foreach ($videos as $video) {
             foreach ($thumbnails as $thumbnail) {
                 if (empty($allowedThumbs) && !$input->getOption("system") || in_array($thumbnail, $allowedThumbs)) {
                     $this->output->writeln("generating thumbnail for video: " . $video->getFullpath() . " | " . $video->getId() . " | Thumbnail: " . $thumbnail . " : " . formatBytes(memory_get_usage()));
                     $video->getThumbnail($thumbnail);
                     $this->waitTillFinished($video->getId(), $thumbnail);
                 }
             }
             if ($input->getOption("system")) {
                 $this->output->writeln("generating thumbnail for video: " . $video->getFullpath() . " | " . $video->getId() . " | Thumbnail: System Preview : " . formatBytes(memory_get_usage()));
                 $thumbnail = Asset\Video\Thumbnail\Config::getPreviewConfig();
                 $video->getThumbnail($thumbnail);
                 $this->waitTillFinished($video->getId(), $thumbnail);
             }
         }
     }
 }
开发者ID:siite,项目名称:choose-sa-cloud,代码行数:53,代码来源:ThumbnailsVideoCommand.php

示例2: array

    echo $e->getMessage();
}
// display help message
if ($opts->getOption("help")) {
    echo $opts->getUsageMessage();
    exit;
}
if ($opts->getOption("verbose")) {
    $writer = new \Zend_Log_Writer_Stream('php://output');
    $logger = new \Zend_Log($writer);
    \Logger::addLogger($logger);
    // set all priorities
    \Logger::setVerbosePriorities();
}
// disable versioning
Version::disable();
// get all thumbnails
$dir = Asset\Video\Thumbnail\Config::getWorkingDir();
$thumbnails = array();
$files = scandir($dir);
foreach ($files as $file) {
    if (strpos($file, ".xml")) {
        $thumbnails[] = str_replace(".xml", "", $file);
    }
}
$allowedThumbs = array();
if ($opts->getOption("thumbnails")) {
    $allowedThumbs = explode(",", $opts->getOption("thumbnails"));
}
// get only images
$conditions = array("type = 'video'");
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:31,代码来源:video-thumbnails.php

示例3: getDuration

 /**
  * @return mixed
  */
 public function getDuration()
 {
     $duration = $this->getCustomSetting("duration");
     if (!$duration) {
         $duration = $this->getDurationFromBackend();
         if ($duration) {
             $this->setCustomSetting("duration", $duration);
             Model\Version::disable();
             $this->save();
             // auto save
             Model\Version::enable();
         }
     }
     return $duration;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:18,代码来源:Video.php


注:本文中的Pimcore\Model\Version::disable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。