verification of number of elements to delete in the function and not before
calling function (for delete_elements and delete_categories) git-svn-id: http://piwigo.org/svn/trunk@521 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
c6e6f131fa
commit
9519786fa4
1 changed files with 11 additions and 4 deletions
|
|
@ -194,6 +194,11 @@ function delete_categories($ids)
|
||||||
{
|
{
|
||||||
global $counts;
|
global $counts;
|
||||||
|
|
||||||
|
if (count($ids) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// destruction of all the related elements
|
// destruction of all the related elements
|
||||||
$query = '
|
$query = '
|
||||||
SELECT id
|
SELECT id
|
||||||
|
|
@ -206,10 +211,7 @@ SELECT id
|
||||||
{
|
{
|
||||||
array_push($element_ids, $row['id']);
|
array_push($element_ids, $row['id']);
|
||||||
}
|
}
|
||||||
if (count($element_ids) > 0)
|
delete_elements($element_ids);
|
||||||
{
|
|
||||||
delete_elements($element_ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
// destruction of the links between images and this category
|
// destruction of the links between images and this category
|
||||||
$query = '
|
$query = '
|
||||||
|
|
@ -269,6 +271,11 @@ function delete_elements($ids)
|
||||||
{
|
{
|
||||||
global $counts;
|
global $counts;
|
||||||
|
|
||||||
|
if (count($ids) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// destruction of the comments on the image
|
// destruction of the comments on the image
|
||||||
$query = '
|
$query = '
|
||||||
DELETE FROM '.COMMENTS_TABLE.'
|
DELETE FROM '.COMMENTS_TABLE.'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue