aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-12-13 14:42:54 +0000
committerplegall <plg@piwigo.org>2011-12-13 14:42:54 +0000
commit5338ef80ef30fced10333868a33718f7d98d9111 (patch)
tree4dae4d50e30085af730edd79b22b86a46406cf16
parent4bc17c2e409f869381812114ca53f7ccf6299e27 (diff)
merge r12725 from branch 2.3 to trunk
feature 2533 added: ability to deactivate uniqueness check on pwg.images.add git-svn-id: http://piwigo.org/svn/trunk@12726 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/ws_functions.inc.php25
-rw-r--r--ws.php1
2 files changed, 15 insertions, 11 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 3673b4a00..46083d9a7 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -1634,24 +1634,27 @@ function ws_images_add($params, &$service)
}
// does the image already exists ?
- if ('md5sum' == $conf['uniqueness_mode'])
- {
- $where_clause = "md5sum = '".$params['original_sum']."'";
- }
- if ('filename' == $conf['uniqueness_mode'])
+ if ($params['check_uniqueness'])
{
- $where_clause = "file = '".$params['original_filename']."'";
- }
+ if ('md5sum' == $conf['uniqueness_mode'])
+ {
+ $where_clause = "md5sum = '".$params['original_sum']."'";
+ }
+ if ('filename' == $conf['uniqueness_mode'])
+ {
+ $where_clause = "file = '".$params['original_filename']."'";
+ }
- $query = '
+ $query = '
SELECT
COUNT(*) AS counter
FROM '.IMAGES_TABLE.'
WHERE '.$where_clause.'
;';
- list($counter) = pwg_db_fetch_row(pwg_query($query));
- if ($counter != 0) {
- return new PwgError(500, 'file already exists');
+ list($counter) = pwg_db_fetch_row(pwg_query($query));
+ if ($counter != 0) {
+ return new PwgError(500, 'file already exists');
+ }
}
if ($params['resize'])
diff --git a/ws.php b/ws.php
index 1b43cc2b5..c7781093b 100644
--- a/ws.php
+++ b/ws.php
@@ -241,6 +241,7 @@ function ws_addDefaultMethods( $arr )
'maxValue' => $conf['available_permission_levels']
),
'resize' => array('default' => false),
+ 'check_uniqueness' => array('default' => true),
),
'POST method only.
<br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given.'