aboutsummaryrefslogtreecommitdiffstats
path: root/admin/update.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2004-11-16 23:38:34 +0000
committerplegall <plg@piwigo.org>2004-11-16 23:38:34 +0000
commit1bf3753f1449eedc4bd39c79b6ca17dc4f396e76 (patch)
tree7d7443b94356cd18a038b3f104f6e21a35d01279 /admin/update.php
parent973e0f8806cd6d569c01977ad5112e16cc7a7f6f (diff)
- 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
Diffstat (limited to '')
-rw-r--r--admin/update.php53
1 files changed, 10 insertions, 43 deletions
diff --git a/admin/update.php b/admin/update.php
index fc920ebb6..817a67aae 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -31,7 +31,7 @@ if( !defined("PHPWG_ROOT_PATH") )
}
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
-define('CURRENT_DATE', "'".date('Y-m-d')."'");
+define('CURRENT_DATE', date('Y-m-d'));
// +-----------------------------------------------------------------------+
// | functions |
// +-----------------------------------------------------------------------+
@@ -407,10 +407,11 @@ SELECT file
if ($tn_ext != '')
{
$insert = array();
- $insert['file'] = "'".$unregistered_element."'";
+ $insert['file'] = $unregistered_element;
$insert['storage_category_id'] = $category_id;
$insert['date_available'] = CURRENT_DATE;
- $insert['tn_ext'] = "'".$tn_ext."'";
+ $insert['tn_ext'] = $tn_ext;
+ $insert['path'] = $dir.$unregistered_element;
$counts['new_elements']++;
array_push($inserts, $insert);
@@ -446,16 +447,17 @@ SELECT file
}
$insert = array();
- $insert['file'] = "'".$unregistered_element."'";
+ $insert['file'] = $unregistered_element;
+ $insert['path'] = $dir.$unregistered_element;
$insert['storage_category_id'] = $category_id;
$insert['date_available'] = CURRENT_DATE;
if ( $tn_ext != '' )
{
- $insert['tn_ext'] = "'".$tn_ext."'";
+ $insert['tn_ext'] = $tn_ext;
}
if ( $representative_ext != '' )
{
- $insert['representative_ext'] = "'".$representative_ext."'";
+ $insert['representative_ext'] = $representative_ext;
}
$counts['new_elements']++;
@@ -475,44 +477,9 @@ SELECT file
// inserts all found pictures
$dbfields = array(
'file','storage_category_id','date_available','tn_ext'
- ,'representative_ext'
+ ,'representative_ext','path'
);
- $query = '
-INSERT INTO '.IMAGES_TABLE.'
- ('.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);
+ mass_inserts(IMAGES_TABLE, $dbfields, $inserts);
// what are the ids of the pictures in the $category_id ?
$ids = array();