节点访问/视图:domain_site和domain_id领域的作用是什么
我在 Drupal 创建的视图中收到重复的节点。该问题似乎与在 node_access 表的视图中完成联接的方式有关。
使用 devel,我看到以下查询:
SELECT node.nid AS nid,
node.language AS node_language,
node_data_field_weekend.field_weekend_value AS node_data_field_weekend_field_weekend_value,
node_data_field_weekend.field_weekend_value2 AS node_data_field_weekend_field_weekend_value2,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_weekend.field_weekend_loc_nid AS node_data_field_weekend_field_weekend_loc_nid
FROM node node
LEFT JOIN content_type_wwme_weekends node_data_field_weekend ON node.vid = node_data_field_weekend.vid
INNER JOIN node_access na ON na.nid = node.nid
WHERE (na.grant_view >= 1 AND
(
(na.gid = 0 AND na.realm = 'all') OR
(na.gid = 0 AND na.realm = 'domain_site') OR
(na.gid = 0 AND na.realm = 'domain_id'))) AND
(
(
(node.type IN ('wwme_weekends')) AND
(node.status <> 0 OR
(node.uid = 0 AND 0 <> 0) OR 0 = 1)) AND
(DATE_FORMAT(STR_TO_DATE(node_data_field_weekend.field_weekend_value, '%Y-%m-%dT%T'), '%Y-%m-%d') > '2010-01-10') )
ORDER BY node_data_field_weekend_field_weekend_value ASC LIMIT 0, 5
与 node_access 表的联接导致其他记录重复,因为一个节点有多个 node_access 记录,其中一个记录的领域为domain_site,另一条记录的领域为domain_id。
数据看起来像这样(为了简洁起见,删除了一些列):
nid gid realm grant_view grant_update grant_delete
73 0 domain_id 1 1 1
73 0 domain_site 1 0 0
988 0 domain_id 1 1 1
988 0 domain_site 1 0 0
90 0 domain_id 1 1 1
该领域适合什么用途?这些记录是如何填充的,最重要的是,我该如何解决这个问题? SQL 正确吗?
I'm getting duplicate nodes in a a view I've created in Drupal. It appears the issue is related to the way the join is done in views for the node_access table.
Using devel, I see the following query:
SELECT node.nid AS nid,
node.language AS node_language,
node_data_field_weekend.field_weekend_value AS node_data_field_weekend_field_weekend_value,
node_data_field_weekend.field_weekend_value2 AS node_data_field_weekend_field_weekend_value2,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_weekend.field_weekend_loc_nid AS node_data_field_weekend_field_weekend_loc_nid
FROM node node
LEFT JOIN content_type_wwme_weekends node_data_field_weekend ON node.vid = node_data_field_weekend.vid
INNER JOIN node_access na ON na.nid = node.nid
WHERE (na.grant_view >= 1 AND
(
(na.gid = 0 AND na.realm = 'all') OR
(na.gid = 0 AND na.realm = 'domain_site') OR
(na.gid = 0 AND na.realm = 'domain_id'))) AND
(
(
(node.type IN ('wwme_weekends')) AND
(node.status <> 0 OR
(node.uid = 0 AND 0 <> 0) OR 0 = 1)) AND
(DATE_FORMAT(STR_TO_DATE(node_data_field_weekend.field_weekend_value, '%Y-%m-%dT%T'), '%Y-%m-%d') > '2010-01-10') )
ORDER BY node_data_field_weekend_field_weekend_value ASC LIMIT 0, 5
The join to the node_access table is causing the other records to duplicate because there are multiple node_access records to a node, one with the realm of domain_site and one record with the realm of domain_id.
The data sort of looks like this (with some columns cut for brevity):
nid gid realm grant_view grant_update grant_delete
73 0 domain_id 1 1 1
73 0 domain_site 1 0 0
988 0 domain_id 1 1 1
988 0 domain_site 1 0 0
90 0 domain_id 1 1 1
What purpose does the realm fit? How are these records populated, and most importantly, how can I fix this? Is the SQL right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为当您有一个打开了多站点访问的 drupal 站点并且您使用域访问模块( http://drupal.org/project/domain)如果您不需要域访问模块,卸载可能会解决部分问题。如果您确实需要它,您很可能需要使用节点访问权限将过滤器添加到您的视图:访问和/或使用域视图模块。这应该会让你朝着正确的方向前进。我自己从未使用过这些模块。我刚刚浏览了模块代码和项目页面。祝你好运!
I think the realms fit in when you have a drupal site with multi site access turned on and your using the Domain Access module (http://drupal.org/project/domain) If you don't need the Domain Access module uninstalling might solve some of this. If you do need it you will most likely need to add a Filter to your view with the Node access: Access and/or use the Domain Views module. That should get you headed in the right direction. I've never worked with these modules myself. I just went through the module code and project pages. Good luck!
答案显然比我想象的要平凡得多:
使用视图下的“不同节点”配置选项,这可以消除欺骗。
The answer apparently was a lot more mundane than I was thinking:
Use the "distinct node" configuration option under views, this takes out dupes.