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


PHP record_adapter::clearSubdefCache方法代码示例

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


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

示例1: generateSubdefs

 public function generateSubdefs(\record_adapter $record, array $wanted_subdefs = null)
 {
     if (null === ($subdefs = $record->get_databox()->get_subdef_structure()->getSubdefGroup($record->get_type()))) {
         $this->logger->info(sprintf('Nothing to do for %s', $record->get_type()));
         return;
     }
     foreach ($subdefs as $subdef) {
         $subdefname = $subdef->get_name();
         if ($wanted_subdefs && !in_array($subdefname, $wanted_subdefs)) {
             continue;
         }
         $pathdest = null;
         if ($record->has_subdef($subdefname) && $record->get_subdef($subdefname)->is_physically_present()) {
             $pathdest = $record->get_subdef($subdefname)->get_pathfile();
             $record->get_subdef($subdefname)->remove_file();
             $this->logger->info(sprintf('Removed old file for %s', $subdefname));
             $record->clearSubdefCache($subdefname);
         }
         $pathdest = $this->generateSubdefPathname($record, $subdef, $pathdest);
         $this->logger->addInfo(sprintf('Generating subdef %s to %s', $subdefname, $pathdest));
         $this->generateSubdef($record, $subdef, $pathdest);
         if ($this->filesystem->exists($pathdest)) {
             $media = $this->mediavorus->guess($pathdest);
             \media_subdef::create($this->app, $record, $subdef->get_name(), $media);
         }
         $record->clearSubdefCache($subdefname);
         $this->app['dispatcher']->dispatch(RecordEvents::SUB_DEFINITION_CREATED, new RecordSubDefinitionCreatedEvent($record, $subdefname));
     }
     return $this;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:30,代码来源:SubdefGenerator.php

示例2: substitute

 public function substitute(\record_adapter $record, $name, MediaInterface $media)
 {
     $newfilename = $record->get_record_id() . '_0_' . $name . '.' . $media->getFile()->getExtension();
     $subdef_def = false;
     if ($name == 'document') {
         $baseprefs = $record->get_databox()->get_sxml_structure();
         $pathhd = \p4string::addEndSlash((string) $baseprefs->path);
         $filehd = $record->get_record_id() . "_document." . strtolower($media->getFile()->getExtension());
         $pathhd = \databox::dispatch($this->fs, $pathhd);
         $this->fs->copy($media->getFile()->getRealPath(), $pathhd . $filehd, true);
         $subdefFile = $pathhd . $filehd;
         $meta_writable = true;
     } else {
         $type = $record->isStory() ? 'image' : $record->get_type();
         $subdef_def = $record->get_databox()->get_subdef_structure()->get_subdef($type, $name);
         if ($record->has_subdef($name) && $record->get_subdef($name)->is_physically_present()) {
             $path_file_dest = $record->get_subdef($name)->get_pathfile();
             $record->get_subdef($name)->remove_file();
             $record->clearSubdefCache($name);
         } else {
             $path = \databox::dispatch($this->fs, $subdef_def->get_path());
             $this->fs->mkdir($path, 0750);
             $path_file_dest = $path . $newfilename;
         }
         try {
             $this->alchemyst->turnInto($media->getFile()->getRealPath(), $path_file_dest, $subdef_def->getSpecs());
         } catch (MediaAlchemystException $e) {
             return;
         }
         $subdefFile = $path_file_dest;
         $meta_writable = $subdef_def->meta_writeable();
     }
     $this->fs->chmod($subdefFile, 0760);
     $media = $this->mediavorus->guess($subdefFile);
     \media_subdef::create($this->app, $record, $name, $media);
     $record->delete_data_from_cache(\record_adapter::CACHE_SUBDEFS);
     if ($meta_writable) {
         $record->write_metas();
     }
     if ($name == 'document') {
         $record->rebuild_subdefs();
     }
     $this->dispatcher->dispatch(RecordEvents::MEDIA_SUBSTITUTED, new RecordMediaSubstitutedEvent($record));
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:44,代码来源:SubdefSubstituer.php


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