From 1bf3753f1449eedc4bd39c79b6ca17dc4f396e76 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 16 Nov 2004 23:38:34 +0000 Subject: - images.path column added to reduce database access - function mass_inserts moved from admin/remote_sites.php to admin/include/function.php - function mass_inserts used in admin/update.php git-svn-id: http://piwigo.org/svn/trunk@606 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/remote_site.php | 52 +++------------------------------------------------ 1 file changed, 3 insertions(+), 49 deletions(-) (limited to 'admin/remote_site.php') diff --git a/admin/remote_site.php b/admin/remote_site.php index 5aaf1a08f..082658ab0 100644 --- a/admin/remote_site.php +++ b/admin/remote_site.php @@ -111,53 +111,6 @@ SELECT id,dir return $database_dirs; } -/** - * inserts multiple lines in a table - * - * @param string table_name - * @param array dbields - * @param array inserts - * @return void - */ -function mass_inserts($table_name, $dbfields, $inserts) -{ - // inserts all found categories - $query = ' -INSERT INTO '.$table_name.' - ('.implode(',', $dbfields).') - VALUES'; - foreach ($inserts as $insert_id => $insert) - { - $query.= ' - '; - if ($insert_id > 0) - { - $query.= ','; - } - $query.= '('; - foreach ($dbfields as $field_id => $dbfield) - { - if ($field_id > 0) - { - $query.= ','; - } - - if (!isset($insert[$dbfield]) or $insert[$dbfield] == '') - { - $query.= 'NULL'; - } - else - { - $query.= "'".$insert[$dbfield]."'"; - } - } - $query.=')'; - } - $query.= ' -;'; - pwg_query($query); -} - /** * read $listing_file and update a remote site according to its id * @@ -418,7 +371,8 @@ SELECT file 'author', 'keywords', 'name', - 'comment'); + 'comment', + 'path'); foreach ($optional_atts as $att) { if (getAttribute($xml_element, $att) != '') @@ -434,7 +388,7 @@ SELECT file { $dbfields = array('file','storage_category_id','date_available','tn_ext', 'filesize','width','height','date_creation','author', - 'keywords','name','comment'); + 'keywords','name','comment','path'); mass_inserts(IMAGES_TABLE, $dbfields, $inserts); $counts{'new_elements'}+= count($inserts); -- cgit v1.2.3