Changeset 12726


Ignore:
Timestamp:
Dec 13, 2011, 3:42:54 PM (9 years ago)
Author:
plg
Message:

merge r12725 from branch 2.3 to trunk

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/ws_functions.inc.php

    r12724 r12726  
    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
  • trunk/ws.php

    r12724 r12726  
    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.