Changeset 8848


Ignore:
Timestamp:
Jan 23, 2011, 1:10:29 AM (9 years ago)
Author:
plg
Message:

bug 2119 fixed: no crash when calling pwg.categories.delete on an empty album

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r8802 r8848  
    9898;';
    9999    $image_ids_linked = array_from_query($query, 'image_id');
    100    
    101     if ('delete_orphans' == $photo_deletion_mode)
    102     {
    103       $query = '
     100
     101    if (count($image_ids_linked) > 0)
     102    {
     103      if ('delete_orphans' == $photo_deletion_mode)
     104      {
     105        $query = '
    104106SELECT
    105107    DISTINCT(image_id)
     
    108110    AND category_id NOT IN ('.implode(',', $ids).')
    109111;';
    110       $image_ids_not_orphans = array_from_query($query, 'image_id');
    111       $image_ids_to_delete = array_diff($image_ids_linked, $image_ids_not_orphans);
    112     }
    113 
    114     if ('force_delete' == $photo_deletion_mode)
    115     {
    116       $image_ids_to_delete = $image_ids_linked;
    117     }
    118 
    119     delete_elements($image_ids_to_delete, true);
     112        $image_ids_not_orphans = array_from_query($query, 'image_id');
     113        $image_ids_to_delete = array_diff($image_ids_linked, $image_ids_not_orphans);
     114      }
     115
     116      if ('force_delete' == $photo_deletion_mode)
     117      {
     118        $image_ids_to_delete = $image_ids_linked;
     119      }
     120
     121      delete_elements($image_ids_to_delete, true);
     122    }
    120123  }
    121124
Note: See TracChangeset for help on using the changeset viewer.