Changeset 8404


Ignore:
Timestamp:
12/31/10 13:34:01 (9 years ago)
Author:
plg
Message:

feature 2089: add the "duplicates" feature to the new Batch Manager and
simplify the algorithm. The duplicates do not rely on physical albums, just
on duplicate filenames.

Location:
trunk/admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager.php

    r8403 r8404  
    5555  if (isset($_POST['filter_prefilter_use'])) 
    5656  { 
    57     $prefilters = array('caddie', 'last import', 'with no album', 'with no tag', 'with no virtual album'); 
     57    $prefilters = array('caddie', 'last import', 'with no album', 'with no tag', 'with no virtual album', 'duplicates'); 
    5858    if (in_array($_POST['filter_prefilter'], $prefilters)) 
    5959    { 
     
    174174      $filter_sets, 
    175175      array_diff($all_elements, $linked_to_virtual) 
     176      ); 
     177  } 
     178 
     179  if ('duplicates' == $_SESSION['bulk_manager_filter']['prefilter']) 
     180  { 
     181    // we could use the group_concat MySQL function to retrieve the list of 
     182    // image_ids but it would not be compatible with PostgreSQL, so let's 
     183    // perform 2 queries instead. We hope there are not too many duplicates. 
     184     
     185    $query = ' 
     186SELECT file 
     187  FROM '.IMAGES_TABLE.' 
     188  GROUP BY file 
     189  HAVING COUNT(*) > 1 
     190;'; 
     191    $duplicate_files = array_from_query($query, 'file'); 
     192     
     193    $query = ' 
     194SELECT id 
     195  FROM '.IMAGES_TABLE.' 
     196  WHERE file IN (\''.implode("','", $duplicate_files).'\') 
     197;'; 
     198 
     199    array_push( 
     200      $filter_sets, 
     201      array_from_query($query, 'id') 
    176202      ); 
    177203  } 
  • trunk/admin/batch_manager_global.php

    r8403 r8404  
    528528  } 
    529529 
     530  if (isset($_SESSION['bulk_manager_filter']['prefilter']) 
     531      and 'duplicates' == $_SESSION['bulk_manager_filter']['prefilter']) 
     532  { 
     533    $conf['order_by'] = ' ORDER BY file, id'; 
     534  } 
     535 
     536 
    530537  $query = ' 
    531538SELECT id,path,tn_ext,file,filesize,level,name 
  • trunk/admin/maintenance.php

    r8403 r8404  
    151151$advanced_features = array(); 
    152152 
    153 array_push( 
    154   $advanced_features, 
    155   array( 
    156     'CAPTION' => l10n('Files with same name in more than one physical album'), 
    157     'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates' 
    158     ) 
    159   ); 
    160  
    161153//$advanced_features is array of array composed of CAPTION & URL 
    162154$advanced_features = trigger_event( 
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r8403 r8404  
    357357          <option value="with no virtual album" {if $filter.prefilter eq 'with no virtual album'}selected="selected"{/if}>with no virtual album</option> 
    358358{/if} 
     359          <option value="duplicates" {if $filter.prefilter eq 'duplicates'}selected="selected"{/if}>duplicates</option> 
    359360<!--          <option value="with no album">with no album</option> --> 
    360 <!--          <option value="with no virtual album">with no virtual album</option> --> 
    361361<!--          <option value="with no tag">with no tag</option> --> 
    362362        </select> 
Note: See TracChangeset for help on using the changeset viewer.