Ignore:
Timestamp:
Jan 9, 2014, 8:44:12 PM (7 years ago)
Author:
plg
Message:

bug 2512 fixed: safely remove photos in community pending list when photo is
deleted (outside Community).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/admin_pendings.php

    r23744 r26557  
    121121// | pending photos list                                                   |
    122122// +-----------------------------------------------------------------------+
     123
     124// just in case (because we had a bug in Community plugin up to version
     125// 2.5.c) let's remove rows in community_pendings table if related photos
     126// has been deleted
     127$query = '
     128SELECT
     129    image_id
     130  FROM '.COMMUNITY_PENDINGS_TABLE.'
     131    LEFT JOIN '.IMAGES_TABLE.' ON id = image_id
     132  WHERE id IS NULL
     133;';
     134$to_delete = array_from_query($query, 'image_id');
     135
     136if (count($to_delete) > 0)
     137{
     138  $query = '
     139DELETE
     140  FROM '.COMMUNITY_PENDINGS_TABLE.'
     141  WHERE image_id IN ('.implode(',', $to_delete).')
     142;';
     143  pwg_query($query);
     144}
    123145
    124146$list = array();
Note: See TracChangeset for help on using the changeset viewer.