Changeset 8827


Ignore:
Timestamp:
Jan 21, 2011, 2:47:54 PM (13 years ago)
Author:
plg
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/pwg_images_addSimple/main.inc.php

    r7780 r8827  
    365365  $image_ids_linked = array_from_query($query, 'image_id');
    366366
    367   $query = '
     367  if (count($image_ids_linked) > 0)
     368  {
     369    $query = '
    368370SELECT
    369371    DISTINCT(image_id)
     
    372374    AND category_id NOT IN ('.implode(',', $all_category_ids).')
    373375;';
    374   $image_ids_not_orphans = array_from_query($query, 'image_id');
    375 
    376   $image_ids_orphans = array_diff($image_ids_linked, $image_ids_not_orphans);
    377  
    378   // print_r($image_ids_not_orphans); exit();
     376    $image_ids_not_orphans = array_from_query($query, 'image_id');
     377    $image_ids_orphans = array_diff($image_ids_linked, $image_ids_not_orphans);
     378 
     379    // print_r($image_ids_not_orphans); exit();
     380  }
    379381
    380382  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     
    382384  update_global_rank();
    383385
    384   delete_elements($image_ids_orphans, true);
     386  if (isset($image_ids_orphans))
     387  {
     388    delete_elements($image_ids_orphans, true);
     389  }
    385390}
    386391
Note: See TracChangeset for help on using the changeset viewer.