mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
feature 2095 added: new column images.added_by (foreign key on users.id)
git-svn-id: http://piwigo.org/svn/trunk@8464 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -184,7 +184,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
|
||||
// TODO
|
||||
// * check md5sum (already exists?)
|
||||
|
||||
global $conf;
|
||||
global $conf, $user;
|
||||
|
||||
// current date
|
||||
list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
|
||||
@@ -306,6 +306,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
|
||||
'width' => $file_infos['width'],
|
||||
'height' => $file_infos['height'],
|
||||
'md5sum' => $md5sum,
|
||||
'added_by' => $user['id'],
|
||||
);
|
||||
|
||||
if (isset($high_infos))
|
||||
|
||||
@@ -449,6 +449,7 @@ SELECT file,storage_category_id
|
||||
? $fs[$path]['tn_ext']
|
||||
: null,
|
||||
'storage_category_id' => $db_fulldirs[$dirname],
|
||||
'added_by' => $user['id'],
|
||||
);
|
||||
|
||||
if ( $_POST['privacy_level']!=0 )
|
||||
|
||||
@@ -1209,7 +1209,7 @@ SELECT
|
||||
|
||||
function ws_images_add($params, &$service)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $user;
|
||||
if (!is_admin())
|
||||
{
|
||||
return new PwgError(401, 'Access denied');
|
||||
@@ -1284,6 +1284,7 @@ SELECT
|
||||
'width' => $file_infos['width'],
|
||||
'height' => $file_infos['height'],
|
||||
'md5sum' => $params['original_sum'],
|
||||
'added_by' => $user['id'],
|
||||
);
|
||||
|
||||
$info_columns = array(
|
||||
|
||||
57
install/db/92-database.php
Normal file
57
install/db/92-database.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
if (!defined('PHPWG_ROOT_PATH'))
|
||||
{
|
||||
die('Hacking attempt!');
|
||||
}
|
||||
|
||||
$upgrade_description = 'New colum images.added_by, reference to users.id';
|
||||
|
||||
// Add column
|
||||
$query = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN ';
|
||||
|
||||
if ('mysql' == $conf['dblayer'])
|
||||
{
|
||||
$query.= ' added_by smallint(5)';
|
||||
}
|
||||
|
||||
if (in_array($conf['dblayer'], array('pgsql', 'sqlite', 'pdo-sqlite')))
|
||||
{
|
||||
$query.= ' "added_by" INTEGER default 0';
|
||||
}
|
||||
|
||||
$query.= ' NOT NULL;';
|
||||
|
||||
pwg_query($query);
|
||||
|
||||
// set the existing photos with the webmaster_id as added_by
|
||||
$query = 'UPDATE '.IMAGES_TABLE.' SET added_by = '.$conf['webmaster_id'].';';
|
||||
pwg_query($query);
|
||||
|
||||
echo
|
||||
"\n"
|
||||
. $upgrade_description
|
||||
."\n"
|
||||
;
|
||||
?>
|
||||
@@ -195,6 +195,7 @@ CREATE TABLE `piwigo_images` (
|
||||
`high_filesize` mediumint(9) unsigned default NULL,
|
||||
`level` tinyint unsigned NOT NULL default '0',
|
||||
`md5sum` char(32) default NULL,
|
||||
`added_by` smallint(5) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `images_i2` (`date_available`),
|
||||
KEY `images_i3` (`average_rate`),
|
||||
|
||||
@@ -191,6 +191,7 @@ CREATE TABLE piwigo_images
|
||||
"high_filesize" INTEGER,
|
||||
"level" INTEGER default 0 NOT NULL,
|
||||
"md5sum" CHAR(32),
|
||||
"added_by" INTEGER default 0 NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
|
||||
@@ -235,6 +235,7 @@ CREATE TABLE "piwigo_images"
|
||||
"high_filesize" INTEGER,
|
||||
"level" INTEGER default 0 NOT NULL,
|
||||
"md5sum" CHAR(32),
|
||||
"added_by" INTEGER default 0 NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
|
||||
@@ -191,6 +191,7 @@ CREATE TABLE piwigo_images
|
||||
"high_filesize" INTEGER,
|
||||
"level" INTEGER default 0 NOT NULL,
|
||||
"md5sum" CHAR(32),
|
||||
"added_by" INTEGER default 0 NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user