Changeset 12725


Ignore:
Timestamp:
12/13/11 15:41:59 (7 years ago)
Author:
plg
Message:

feature 2533 added: ability to deactivate uniqueness check on pwg.images.add

Location:
branches/2.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/include/ws_functions.inc.php

    r12723 r12725  
    16351635 
    16361636  // does the image already exists ? 
    1637   if ('md5sum' == $conf['uniqueness_mode']) 
    1638   { 
    1639     $where_clause = "md5sum = '".$params['original_sum']."'"; 
    1640   } 
    1641   if ('filename' == $conf['uniqueness_mode']) 
    1642   { 
    1643     $where_clause = "file = '".$params['original_filename']."'"; 
    1644   } 
    1645  
    1646   $query = ' 
     1637  if ($params['check_uniqueness']) 
     1638  { 
     1639    if ('md5sum' == $conf['uniqueness_mode']) 
     1640    { 
     1641      $where_clause = "md5sum = '".$params['original_sum']."'"; 
     1642    } 
     1643    if ('filename' == $conf['uniqueness_mode']) 
     1644    { 
     1645      $where_clause = "file = '".$params['original_filename']."'"; 
     1646    } 
     1647 
     1648    $query = ' 
    16471649SELECT 
    16481650    COUNT(*) AS counter 
     
    16501652  WHERE '.$where_clause.' 
    16511653;'; 
    1652   list($counter) = pwg_db_fetch_row(pwg_query($query)); 
    1653   if ($counter != 0) { 
    1654     return new PwgError(500, 'file already exists'); 
     1654    list($counter) = pwg_db_fetch_row(pwg_query($query)); 
     1655    if ($counter != 0) { 
     1656      return new PwgError(500, 'file already exists'); 
     1657    } 
    16551658  } 
    16561659 
  • branches/2.3/ws.php

    r12722 r12725  
    242242        ), 
    243243      'resize' => array('default' => false), 
     244      'check_uniqueness' => array('default' => true), 
    244245      ), 
    245246    'POST method only. 
Note: See TracChangeset for help on using the changeset viewer.