allow to insert files with differing extension but same basename and mimetype

This commit is contained in:
Garvin Hicking 2011-04-21 15:07:33 +00:00
parent 288c937f60
commit 18ff07d7ce
2 changed files with 11 additions and 5 deletions

View File

@ -3,6 +3,10 @@
Version 1.6 ()
------------------------------------------------------------------------
* Fixed a bug in synchronizing new files with the same basename
but different extensions, where files with the same mimetype
would not get added (garvinhicking)
* Show subscription status of comments in frontend and backend
* Added ability to report spam/ham to akismet (Black Warthog)

View File

@ -1152,7 +1152,8 @@ function serendipity_syncThumbs($deleteThumbs = false) {
$cond = array(
'and' => "WHERE name = '" . serendipity_db_escape_string($fbase) . "'
" . ($fdir != '' ? "AND path = '" . serendipity_db_escape_string($fdir) . "'" : '') . "
AND mime = '" . serendipity_db_escape_string($fdim['mime']) . "'"
AND mime = '" . serendipity_db_escape_string($fdim['mime']) . "'
AND extension = '" . serendipity_db_escape_string($f[1]) . "'"
);
serendipity_ACL_SQL($cond, false, 'directory');
@ -1161,6 +1162,7 @@ function serendipity_syncThumbs($deleteThumbs = false) {
{$cond['joins']}
{$cond['and']}", true, 'assoc');
if (is_array($rs)) {
// This image is in the database. Check our calculated data against the database data.
$update = array();
@ -1187,12 +1189,12 @@ function serendipity_syncThumbs($deleteThumbs = false) {
/* Do the database update, if needed */
if (sizeof($update) != 0) {
printf(FOUND_FILE . '<br />', $files[$x]);
printf(FOUND_FILE . ' (2)<br />', $files[$x]);
serendipity_updateImageInDatabase($update, $rs['id']);
$i++;
}
} else {
printf(FOUND_FILE . '<br />', $files[$x]);
printf(FOUND_FILE . ' (1)<br />', $files[$x]);
serendipity_insertImageInDatabase($fbase . '.' . $f[1], $fdir, 0, filemtime($ffull));
$i++;
}