diff options
Diffstat (limited to 'install')
-rw-r--r-- | install/config.sql | 3 | ||||
-rw-r--r-- | install/db/94-database.php | 93 | ||||
-rw-r--r-- | install/piwigo_structure-mysql.sql | 19 | ||||
-rw-r--r-- | install/piwigo_structure-pdo-sqlite.sql | 20 | ||||
-rw-r--r-- | install/piwigo_structure-pgsql.sql | 25 | ||||
-rw-r--r-- | install/piwigo_structure-sqlite.sql | 21 |
6 files changed, 93 insertions, 88 deletions
diff --git a/install/config.sql b/install/config.sql index 02f6f71a1..e96a7cf30 100644 --- a/install/config.sql +++ b/install/config.sql @@ -26,11 +26,8 @@ INSERT INTO piwigo_config (param,value,comment) VALUES ('nbm_send_recent_post_da INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to theadministrators when a user registers'); INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_comment','false','Send an email to the administrators when a valid comment is entered'); INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the administrators when a comment requires validation'); -INSERT INTO piwigo_config (param,value,comment) VALUES ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded'); INSERT INTO piwigo_config (param,value,comment) VALUES ('obligatory_user_mail_address','false','Mail address is obligatory for users'); INSERT INTO piwigo_config (param,value,comment) VALUES ('c13y_ignore',null,'List of ignored anomalies'); -INSERT INTO piwigo_config (param,value,comment) VALUES ('upload_link_everytime','false','Show upload link every time'); -INSERT INTO piwigo_config (param,value,comment) VALUES ('upload_user_access',2 /*ACCESS_CLASSIC*/,'User access level to upload'); INSERT INTO piwigo_config (param,value,comment) VALUES ('extents_for_templates','a:0:{}','Actived template-extension(s)'); INSERT INTO piwigo_config (param,value,comment) VALUES ('blk_menubar','','Menubar options'); INSERT INTO piwigo_config (param,value,comment) VALUES ('menubar_filter_icon','true','Display filter icon'); diff --git a/install/db/94-database.php b/install/db/94-database.php new file mode 100644 index 000000000..fbaa5a3cf --- /dev/null +++ b/install/db/94-database.php @@ -0,0 +1,93 @@ +<?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 = 'remove user upload as core feature and save config for Community plugin'; + +$user_upload_conf = array(); + +// upload_user_access +$conf_orig = $conf; +load_conf_from_db(); +$user_upload_conf['upload_user_access'] = $conf['upload_user_access']; +$conf = $conf_orig; + +// unvalidated photos submitted by users +$query = ' +SELECT * + FROM '.PREFIX_TABLE.'waiting +;'; +$result = pwg_query($query); +$user_upload_conf['waiting_rows'] = array(); +while ($row = pwg_db_fetch_assoc($result)) { + array_push($user_upload_conf['waiting_rows'], $row); +} + +// uploadable categories +$query = ' +SELECT id + FROM '.CATEGORIES_TABLE.' + WHERE uploadable = \'true\' +;'; +$result = pwg_query($query); +$user_upload_conf['uploadable_categories'] = array(); +while ($row = pwg_db_fetch_assoc($result)) { + array_push($user_upload_conf['uploadable_categories'], $row['id']); +} + +// save configuration for a future use by the Community plugin +$backup_filepath = $conf['local_data_dir'].'/plugins/core_user_upload_to_community.php'; +mkgetdir(dirname($backup_filepath)); + +file_put_contents( + $backup_filepath, + '<?php $user_upload_conf = \''.serialize($user_upload_conf).'\'; ?>' + ); + +// +// remove all what is related to user upload in the database +// + +// categories.uploadable +pwg_query('ALTER TABLE '.CATEGORIES_TABLE.' DROP COLUMN uploadable;'); + +// waiting +pwg_query('DROP TABLE '.PREFIX_TABLE.'waiting;'); + +// config parameter settings : upload_user_access, upload_link_everytime +$query = ' +DELETE FROM '.PREFIX_TABLE.'config + WHERE param IN (\'upload_user_access\', \'upload_link_everytime\', \'email_admin_on_picture_uploaded\') +;'; +pwg_query($query); + +echo +"\n" +. $upgrade_description +."\n" +; +?> diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql index a241ab1f4..39184daab 100644 --- a/install/piwigo_structure-mysql.sql +++ b/install/piwigo_structure-mysql.sql @@ -30,7 +30,6 @@ CREATE TABLE `piwigo_categories` ( `status` enum('public','private') NOT NULL default 'public', `site_id` tinyint(4) unsigned default '1', `visible` enum('true','false') NOT NULL default 'true', - `uploadable` enum('true','false') NOT NULL default 'false', `representative_picture_id` mediumint(8) unsigned default NULL, `uppercats` varchar(255) NOT NULL default '', `commentable` enum('true','false') NOT NULL default 'true', @@ -446,21 +445,3 @@ CREATE TABLE `piwigo_users` ( PRIMARY KEY (`id`), UNIQUE KEY `users_ui1` (`username`) ) TYPE=MyISAM; - --- --- Table structure for table `piwigo_waiting` --- - -DROP TABLE IF EXISTS `piwigo_waiting`; -CREATE TABLE `piwigo_waiting` ( - `id` int(10) unsigned NOT NULL auto_increment, - `storage_category_id` smallint(5) unsigned NOT NULL default '0', - `file` varchar(255) NOT NULL default '', - `username` varchar(255) NOT NULL default '', - `mail_address` varchar(255) NOT NULL default '', - `date` int(10) unsigned NOT NULL default '0', - `tn_ext` char(3) default NULL, - `validated` enum('true','false') NOT NULL default 'false', - `infos` text, - PRIMARY KEY (`id`) -) TYPE=MyISAM; diff --git a/install/piwigo_structure-pdo-sqlite.sql b/install/piwigo_structure-pdo-sqlite.sql index 0c38b4008..c01f55892 100644 --- a/install/piwigo_structure-pdo-sqlite.sql +++ b/install/piwigo_structure-pdo-sqlite.sql @@ -26,7 +26,6 @@ CREATE TABLE "piwigo_categories" "status" VARCHAR(50) default 'public', "site_id" INTEGER default 1, "visible" BOOLEAN default true, - "uploadable" BOOLEAN default false, "representative_picture_id" INTEGER, "uppercats" TEXT, "commentable" BOOLEAN default true, @@ -537,22 +536,3 @@ CREATE TABLE piwigo_comments CREATE INDEX "comments_i2" ON "piwigo_comments" ("validation_date"); CREATE INDEX "comments_i1" ON "piwigo_comments" ("image_id"); ------------------------------------------------------------------------------ --- piwigo_waiting ------------------------------------------------------------------------------ - -DROP TABLE IF EXISTS piwigo_waiting; -CREATE TABLE piwigo_waiting -( - "id" INTEGER NOT NULL, - "storage_category_id" INTEGER default 0 NOT NULL, - "file" VARCHAR(255) default '' NOT NULL, - "username" VARCHAR(255) default '' NOT NULL, - "mail_address" VARCHAR(255) default '' NOT NULL, - "date" INTEGER default 0 NOT NULL, - "tn_ext" CHAR(3), - "validated" BOOLEAN default false, - "infos" TEXT, - PRIMARY KEY ("id") -); - diff --git a/install/piwigo_structure-pgsql.sql b/install/piwigo_structure-pgsql.sql index 5f9d5a8cf..feab9acc3 100644 --- a/install/piwigo_structure-pgsql.sql +++ b/install/piwigo_structure-pgsql.sql @@ -33,7 +33,6 @@ CREATE TABLE "piwigo_categories" "status" CATEGORIES_STATUS default 'public'::CATEGORIES_STATUS, "site_id" INTEGER default 1, "visible" BOOLEAN default true, - "uploadable" BOOLEAN default false, "representative_picture_id" INTEGER, "uppercats" TEXT, "commentable" BOOLEAN default true, @@ -652,27 +651,3 @@ SET search_path TO public; CREATE INDEX "comments_i2" ON "piwigo_comments" ("validation_date"); CREATE INDEX "comments_i1" ON "piwigo_comments" ("image_id"); - ------------------------------------------------------------------------------ --- piwigo_waiting ------------------------------------------------------------------------------ - -DROP TABLE IF EXISTS "piwigo_waiting" CASCADE; -CREATE TABLE "piwigo_waiting" -( - "id" serial NOT NULL, - "storage_category_id" INTEGER default 0 NOT NULL, - "file" VARCHAR(255) default '' NOT NULL, - "username" VARCHAR(255) default '' NOT NULL, - "mail_address" VARCHAR(255) default '' NOT NULL, - "date" INTEGER default 0 NOT NULL, - "tn_ext" CHAR(3), - "validated" BOOLEAN default false, - "infos" TEXT, - PRIMARY KEY ("id") -); - -COMMENT ON TABLE "piwigo_waiting" IS ''; - - -SET search_path TO public;
\ No newline at end of file diff --git a/install/piwigo_structure-sqlite.sql b/install/piwigo_structure-sqlite.sql index 0c38b4008..54e2f0d12 100644 --- a/install/piwigo_structure-sqlite.sql +++ b/install/piwigo_structure-sqlite.sql @@ -26,7 +26,6 @@ CREATE TABLE "piwigo_categories" "status" VARCHAR(50) default 'public', "site_id" INTEGER default 1, "visible" BOOLEAN default true, - "uploadable" BOOLEAN default false, "representative_picture_id" INTEGER, "uppercats" TEXT, "commentable" BOOLEAN default true, @@ -536,23 +535,3 @@ CREATE TABLE piwigo_comments CREATE INDEX "comments_i2" ON "piwigo_comments" ("validation_date"); CREATE INDEX "comments_i1" ON "piwigo_comments" ("image_id"); - ------------------------------------------------------------------------------ --- piwigo_waiting ------------------------------------------------------------------------------ - -DROP TABLE IF EXISTS piwigo_waiting; -CREATE TABLE piwigo_waiting -( - "id" INTEGER NOT NULL, - "storage_category_id" INTEGER default 0 NOT NULL, - "file" VARCHAR(255) default '' NOT NULL, - "username" VARCHAR(255) default '' NOT NULL, - "mail_address" VARCHAR(255) default '' NOT NULL, - "date" INTEGER default 0 NOT NULL, - "tn_ext" CHAR(3), - "validated" BOOLEAN default false, - "infos" TEXT, - PRIMARY KEY ("id") -); - |