Closed (fixed)
Project:
Node Gallery
Version:
6.x-3.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Jan 2012 at 12:48 UTC
Updated:
30 Nov 2012 at 21:30 UTC
I get the following error when I delete a node.
notice: Undefined variable: gid in _node_gallery_delete() (line 815 of /public_html/sites/all/modules/node_gallery/node_gallery.module).
It is in the function _node_gallery_delete(&$node) and the actual line that calls it is
node_gallery_clear_gallery_caches($gid);
I think the simple answer would be to set $gid to NULL unless there is a reason to set it to something else because everything in the function is in if statements except clearing the cache.
The other solution would be to move the statement into the either or both if statements.
function _node_gallery_delete(&$node) {
+ $gid = NULL;
if (in_array($node->type, (array)node_gallery_get_types('gallery'))) {
$gid = $node->nid;
$imagenids = node_gallery_get_image_nids($gid, FALSE, FALSE, TRUE);
$total = count($imagenids);
// Split our operations into X deletes at a time
while (count($imagenids) > 0) {
if (count($imagenids) >= NODE_GALLERY_BATCH_DELETE) {
$nids = array_splice($imagenids, 0, 10);
}
else {
$nids = $imagenids;
unset($imagenids);
}
$operations[] = array('node_gallery_image_delete_process', array($nids));
}
if (!empty($operations)) {
$batch = array(
'operations' => $operations,
'finished' => 'node_gallery_image_process_finished',
'title' => t('Processing Gallery Delete.'),
'init_message' => t('Gallery deletion is cascading to images.'),
'progress_message' => t('Processing image deletions.'),
'error_message' => t('Gallery deletion has encountered an error.'),
);
batch_set($batch);
}
node_gallery_delete_gallery($node);
}
if (in_array($node->type, (array)node_gallery_get_types('image'))) {
$gid = $node->gid;
node_gallery_delete_image($node);
}
node_gallery_clear_gallery_caches($gid);
}
Comments
Comment #1
zengenuity commentedCommitted to 3.x-dev: http://drupalcode.org/project/node_gallery.git/commit/726ee36bd58e5d379e...