diff options
author | plegall <plg@piwigo.org> | 2005-04-20 19:09:50 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2005-04-20 19:09:50 +0000 |
commit | b56bd6748a134ef35be64624724ac82bc922906a (patch) | |
tree | 7c5ab0e96e74aeddd5239c8fd56f0d8b62928334 /admin | |
parent | 6b5f3a4a8209b36c4fbf1bf845c18b5e3d232154 (diff) |
- bug 96 : informations given by uploaders were never used during database
synchronisation. A new block has been added to retrieve "waiting" table
informations and transfer them to "images" table.
git-svn-id: http://piwigo.org/svn/branches/branch-1_4@765 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/update.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/admin/update.php b/admin/update.php index 56843d21a..59e748198 100644 --- a/admin/update.php +++ b/admin/update.php @@ -453,6 +453,62 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id echo '<!-- scanning files : '; echo get_elapsed_time($start_files, get_moment()); echo ' -->'."\n"; + + // retrieving informations given by uploaders + if (!$simulate) + { + $query = ' +SELECT id,file,storage_category_id,infos + FROM '.WAITING_TABLE.' + WHERE storage_category_id IN ( +'.wordwrap(implode(', ', $cat_ids), 80, "\n").') + AND validated = \'true\' +;'; + $result = pwg_query($query); + + $datas = array(); + $fields = + array( + 'primary' => array('id'), + 'update' => array('date_creation', 'author', 'name', 'comment') + ); + + $waiting_to_delete = array(); + + while ($row = mysql_fetch_array($result)) + { + $data = array(); + + $query = ' +SELECT id + FROM '.IMAGES_TABLE.' + WHERE storage_category_id = \''.$row['storage_category_id'].'\' + AND file = \''.$row['file'].'\' +;'; + list($data['id']) = mysql_fetch_array(pwg_query($query)); + + foreach ($fields['update'] as $field) + { + $data[$field] = getAttribute($row['infos'], $field); + } + + array_push($datas, $data); + array_push($waiting_to_delete, $row['id']); + } + + if (count($datas) > 0) + { + mass_updates(IMAGES_TABLE, $fields, $datas); + + // delete now useless waiting elements + $query = ' +DELETE + FROM '.WAITING_TABLE.' + WHERE id IN ('.implode(',', $waiting_to_delete).') +;'; + pwg_query($query); + } + } } // +-----------------------------------------------------------------------+ // | template initialization | |