aboutsummaryrefslogtreecommitdiffstats
path: root/admin/site_update.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-12-03 16:04:02 +0100
committerplegall <plg@piwigo.org>2015-12-03 16:04:02 +0100
commit8e098d502a8f0e413b9c085db27d6a62a6c0909f (patch)
tree04bdf84e30becac7b8ed7b0b98fa7696b9979d5e /admin/site_update.php
parent27389102d1275cdefcaee9c5a4a93297fc797b8c (diff)
feature #379 multiple format, step 1: add formats
* new table piwigo_image_format (each photo can have 0 to many formats) * only compatible with synchronization for now. Formats must be in sub-directory pwg_format * formats are visible on edition page only for now
Diffstat (limited to '')
-rw-r--r--admin/site_update.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/admin/site_update.php b/admin/site_update.php
index 5bcaea12a..3a12965af 100644
--- a/admin/site_update.php
+++ b/admin/site_update.php
@@ -457,6 +457,7 @@ if (isset($_POST['submit']) and $_POST['sync'] == 'files'
$start= $start_files;
$fs = $site_reader->get_elements($basedir);
+
$template->append('footer_elements', '<!-- get_elements: '
. get_elapsed_time($start, get_moment())
. ' -->' );
@@ -486,6 +487,7 @@ SELECT id, path
$inserts = array();
$insert_links = array();
+ $insert_formats = array();
foreach (array_diff(array_keys($fs), $db_elements) as $path)
{
@@ -535,6 +537,22 @@ SELECT id, path
'info' => l10n('added')
);
+ foreach ($fs[$path]['formats'] as $format)
+ {
+ list($ext, $filesize) = explode('/', $format);
+
+ $insert_formats[] = array(
+ 'image_id' => $insert['id'],
+ 'ext' => $ext,
+ 'filesize' => $filesize,
+ );
+
+ $infos[] = array(
+ 'path' => $insert['path'],
+ 'info' => l10n('format %s added', $ext)
+ );
+ }
+
$caddiables[] = $insert['id'];
}
@@ -555,6 +573,16 @@ SELECT id, path
array_keys($insert_links[0]),
$insert_links
);
+
+ // inserts all formats
+ if (count($insert_formats) > 0)
+ {
+ mass_inserts(
+ IMAGE_FORMAT_TABLE,
+ array_keys($insert_formats[0]),
+ $insert_formats
+ );
+ }
// add new photos to caddie
if (isset($_POST['add_to_caddie']) and $_POST['add_to_caddie'] == 1)