aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-12-23 10:10:34 +0100
committerplegall <plg@piwigo.org>2015-12-23 10:10:34 +0100
commit99b1fd270445c719d85aacc9e3a8e7add1cd5106 (patch)
tree0c9562bc6353cce888dbf73dada59d3cbd963290
parente439de1612eb471571c5a1503fba7f6531a90c08 (diff)
feature #379, multiple format, bug fixed on sync
New formats were not detected if the photo had not already at least one format.
-rw-r--r--admin/site_update.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/admin/site_update.php b/admin/site_update.php
index 411a527c9..2a70ae5d9 100644
--- a/admin/site_update.php
+++ b/admin/site_update.php
@@ -592,6 +592,7 @@ SELECT *
$db_formats[$row['image_id']][$row['ext']] = $row['format_id'];
}
+ // first we search the formats that were removed
$formats_to_delete = array();
foreach ($db_formats as $image_id => $formats)
@@ -607,8 +608,20 @@ SELECT *
'info' => l10n('format %s removed', $ext)
);
}
+ }
- $image_formats_to_insert = array_diff_key($fs[ $db_elements[$image_id] ]['formats'], $formats);
+ // then we search for new formats on existing photos
+ foreach ($existing_ids as $image_id)
+ {
+ $path = $db_elements[$image_id];
+
+ $formats = array();
+ if (isset($db_formats[$image_id]))
+ {
+ $formats = $db_formats[$image_id];
+ }
+
+ $image_formats_to_insert = array_diff_key($fs[$path]['formats'], $formats);
$logger->debug('image_formats_to_insert', 'sync', $image_formats_to_insert);
foreach ($image_formats_to_insert as $ext => $filesize)
{