Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
c4526416
Commit
c4526416
authored
Dec 25, 2006
by
drumm
Browse files
#104508
by Steven. Use standard SQL for updating post grants.
parent
9c86de18
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/node/node.module
View file @
c4526416
...
...
@@ -2848,33 +2848,17 @@ function node_access_write_grants($node, $grants, $realm = NULL, $delete = TRUE)
db_query
(
$query
,
$node
->
nid
,
$realm
);
}
//
o
nly perform work when node_access modules are active
//
O
nly perform work when node_access modules are active
.
if
(
count
(
module_implements
(
'node_grants'
)))
{
// This optimization reduces the number of db inserts a little bit. We could
// optimize further for mass updates if we wanted.
$values
=
array
();
$query
=
''
;
foreach
(
$grants
as
$grant
)
{
if
(
$realm
&&
$realm
!=
$grant
[
'realm'
])
{
continue
;
}
// Only write grants; denies are implicit.
if
(
$grant
[
'grant_view'
]
||
$grant
[
'grant_update'
]
||
$grant
[
'grant_delete'
])
{
$query
.
=
(
$query
?
', '
:
''
)
.
"(%d, '%s', %d, %d, %d, %d)"
;
$values
[]
=
$node
->
nid
;
$values
[]
=
$grant
[
'realm'
];
$values
[]
=
$grant
[
'gid'
];
$values
[]
=
$grant
[
'grant_view'
];
$values
[]
=
$grant
[
'grant_update'
];
$values
[]
=
$grant
[
'grant_delete'
];
db_query
(
"INSERT INTO
{
node_access
}
(nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (%d, '%s', %d, %d, %d, %d)"
,
$node
->
nid
,
$grant
[
'realm'
],
$grant
[
'gid'
],
$grant
[
'grant_view'
],
$grant
[
'grant_update'
],
$grant
[
'grant_delete'
]);
}
}
if
(
$values
)
{
$query
=
"INSERT INTO
{
node_access
}
(nid, realm, gid, grant_view, grant_update, grant_delete) VALUES "
.
$query
;
db_query
(
$query
,
$values
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment