apache无权访问问题的解决
问题:
You don't have permission to access / on this server apache 2.2.15
检查日志发现问题:
htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
搜索:
原因,启用了selinux,导致不正常。
问题:
You don't have permission to access / on this server apache 2.2.15
检查日志发现问题:
htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
搜索:
原因,启用了selinux,导致不正常。
ios版本下面,media模块提供的上传,一致存在问题,用户无法滚动到下面,点击保存按钮。
media 模块,media/templates下面的模板文件,增加了以下内容:
<div class="mainContainer-scroll" style="position:absolute;height:100%;width:100%;top:0;left:0;-webkit-overflow-scrolling: touch;-webkit-transform: translate3d(0, 0, 0);overflow-y:scroll;">
<div class="Content" style="height:2000px;width:100%;">
...
</div>
</div>
解决ios下面,无法滚动到下面的问题。增加CSS
.ui-dialog.media-wrapper{
问题描述:
用户的视频播放,总是存在问题,苹果下面播放不了,我采取了趋势,android的可以了,但是苹果不行。
后来无意中发现,竟然是客户网站采用私有文件系统导致的,同样的视频,在公开的文件系统下面就可以。原来的文件都存储成了私有格式,也不便于直接转换回来。我查找了一下,有这个一个模块,刚好解决这个问题。
Drupal does not support download resume , meaning that downloading large private files can be troublesome because if for any
reason the download fails , there is no way to continue downloading from where it stopped and the whole file should be
downloaded again.
It also supports several extra features
我们经常会遇到一个实体多个类型,每个类型有自己的字段,这个在Drupal里面默认支持。
但是在NodeJS和MongoDB下面如何实现呢。
我找了几篇文章
Polymorphic user model with mongoose and node.js
https://stackoverflow.com/questions/24561182/polymorphic-user-model-with-mongoose-and-node-js
http://thecodebarbarian.com/2015/07/24/guide-to-mongoose-discriminators
注意这两个单词:
Polymorphic : 多态
discriminators:辨别者,鉴别器
使用no_cache这个配置选项,示例如下
mydownload.downloadlist:
path: '/mydownloads/{resource_type}/{resource_id}'
defaults:
_controller: '\Drupal\mydownload\Controller\MyDownloadController::downloadList'
_title: 'Download'
requirements:
_custom_access: '\Drupal\mydownload\Controller\MyDownloadController::access'
resource_type: '[a-z0-9_]+'
options:
no_cache: 'TRUE'
经常会在项目中遇到,比如使用feeds导入,Drupal8下面只对文本字段支持的比较友好,
我们要根据A字段的值,经过一定的运算,赋值给B字段,通常我会使用下面的这段代码实现:
/**
* @file
* 为j_resource实现接口hook_ENTITY_TYPE_presave.
*/
function mycustom_j_resource_presave(EntityInterface $entity) {
//j_marcid保存的字符串形式,根据它的值获取到对应的id,赋值给j_marc_id
if (!empty($entity->j_marcid->value) && empty($entity->j_marc_id->target_id)) {
//查询
我们在给客户定制的文件下载模块里面,客户想对资源进行统计,我们使用了views。不过统计总计的数据库表里面:
我们使用了resource_type,resource_id两个字段存储关联关系,这样模块可以支持多个资源实体类型。一个资源对应一个实体类型。
但是views自身并不直接支持这样的动态的关联。我们尝试了一下,通过自定义代码可以搞定:
/**
* Implements hook_views_data().
*/
function mydownload_views_data() {
$data['mydownload_count']['table']['group'] = t('Download statistics');
$resource_types = mydownload_get_resource_types();
foreach($resource_types as $resource_type){
客户的文件很多,也很大,按照特定的目录进行管理,比如一个期刊下面有很多个PDF文件。如果把所有文件都放到Drupal的文件系统中的话,关联导入都不大方便。
为了解决客户的文件管理,我们只管理某一个期刊的目录,目录下面的文件的下载,展示都通过程序来控制。这个功能在Drupal8下面没有现成的模块。
我们经过讨论,帮助客户定制了一个私有文件的下载管理模块。
需求:
客户自己维护一个私有文件目录,里面的目录结构元信息,整理成csv文件。
只管理目录的信息,一个期刊对应一个目录,这个目录列出期刊的所有可用pdf。
用户查看期刊的时候,可以查看这个期刊下面的所有文件,
点击需要的文件可以下载。下载需要支持统计。
关键代码:
/**
* Download list page.
*/
public function downloadList($resource_type, $resource_id) {