aboutsummaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--install/config.sql2
-rw-r--r--install/db/109-database.php41
-rw-r--r--install/piwigo_structure-mysql.sql4
-rw-r--r--install/piwigo_structure-pdo-sqlite.sql4
-rw-r--r--install/piwigo_structure-pgsql.sql4
-rw-r--r--install/piwigo_structure-sqlite.sql4
6 files changed, 50 insertions, 9 deletions
diff --git a/install/config.sql b/install/config.sql
index aeeacc085..62077301a 100644
--- a/install/config.sql
+++ b/install/config.sql
@@ -47,7 +47,7 @@ INSERT INTO piwigo_config (param,value,comment) VALUES ('picture_menu','false','
INSERT INTO piwigo_config (param,value,comment)
VALUES (
'picture_informations',
- 'a:11:{s:6:"author";b:1;s:10:"created_on";b:1;s:9:"posted_on";b:1;s:10:"dimensions";b:1;s:4:"file";b:1;s:8:"filesize";b:1;s:4:"tags";b:1;s:10:"categories";b:1;s:6:"visits";b:1;s:12:"average_rate";b:1;s:13:"privacy_level";b:1;}',
+ 'a:11:{s:6:"author";b:1;s:10:"created_on";b:1;s:9:"posted_on";b:1;s:10:"dimensions";b:1;s:4:"file";b:1;s:8:"filesize";b:1;s:4:"tags";b:1;s:10:"categories";b:1;s:6:"visits";b:1;s:12:"rating_score";b:1;s:13:"privacy_level";b:1;}',
'Information displayed on picture page'
);
INSERT INTO piwigo_config (param,value,comment) VALUES ('week_starts_on','monday','Monday may not be the first day of the week');
diff --git a/install/db/109-database.php b/install/db/109-database.php
new file mode 100644
index 000000000..391942ee4
--- /dev/null
+++ b/install/db/109-database.php
@@ -0,0 +1,41 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 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. |
+// +-----------------------------------------------------------------------+
+
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
+
+$upgrade_description = 'Rename #images.average_rate to ratingscore.';
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+if ('mysql' == $conf['dblayer'])
+ $q = 'ALTER TABLE '.IMAGES_TABLE.' CHANGE average_rate rating_score float(5,2) unsigned default NULL';
+else
+ $q = 'ALTER TABLE '.IMAGES_TABLE.' RENAME average_rate TO rating_score';
+pwg_query($q);
+
+$q="UPDATE ".CATEGORIES_TABLE." SET image_order=REPLACE(image_order, 'average_rate', 'rating_score')";
+pwg_query($q);
+
+$q="UPDATE ".CONFIG_TABLE." SET value=REPLACE(value, 'average_rate', 'rating_score')
+WHERE param IN ('picture_informations', 'order_by', 'order_by_inside_category')";
+pwg_query($q);
+?> \ No newline at end of file
diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql
index cc05c311f..b149d3918 100644
--- a/install/piwigo_structure-mysql.sql
+++ b/install/piwigo_structure-mysql.sql
@@ -187,7 +187,7 @@ CREATE TABLE `piwigo_images` (
`height` smallint(9) unsigned default NULL,
`representative_ext` varchar(4) default NULL,
`date_metadata_update` date default NULL,
- `average_rate` float(5,2) unsigned default NULL,
+ `rating_score` float(5,2) unsigned default NULL,
`has_high` enum('true') default NULL,
`path` varchar(255) NOT NULL default '',
`storage_category_id` smallint(5) unsigned default NULL,
@@ -199,7 +199,7 @@ CREATE TABLE `piwigo_images` (
`added_by` smallint(5) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `images_i2` (`date_available`),
- KEY `images_i3` (`average_rate`),
+ KEY `images_i3` (`rating_score`),
KEY `images_i4` (`hit`),
KEY `images_i5` (`date_creation`),
KEY `images_i1` (`storage_category_id`)
diff --git a/install/piwigo_structure-pdo-sqlite.sql b/install/piwigo_structure-pdo-sqlite.sql
index a0b502fc8..46132f7be 100644
--- a/install/piwigo_structure-pdo-sqlite.sql
+++ b/install/piwigo_structure-pdo-sqlite.sql
@@ -183,7 +183,7 @@ CREATE TABLE piwigo_images
"height" INTEGER,
"representative_ext" VARCHAR(4),
"date_metadata_update" DATE,
- "average_rate" FLOAT,
+ "rating_score" FLOAT,
"has_high" BOOLEAN default false,
"path" VARCHAR(255) default '' NOT NULL,
"storage_category_id" INTEGER,
@@ -199,7 +199,7 @@ CREATE TABLE piwigo_images
CREATE INDEX "images_i2" ON "piwigo_images" ("date_available");
-CREATE INDEX "images_i3" ON "piwigo_images" ("average_rate");
+CREATE INDEX "images_i3" ON "piwigo_images" ("rating_score");
CREATE INDEX "images_i4" ON "piwigo_images" ("hit");
diff --git a/install/piwigo_structure-pgsql.sql b/install/piwigo_structure-pgsql.sql
index cf55dea0c..7fb3da355 100644
--- a/install/piwigo_structure-pgsql.sql
+++ b/install/piwigo_structure-pgsql.sql
@@ -227,7 +227,7 @@ CREATE TABLE "piwigo_images"
"height" INTEGER,
"representative_ext" VARCHAR(4),
"date_metadata_update" DATE,
- "average_rate" FLOAT,
+ "rating_score" FLOAT,
"has_high" BOOLEAN default false,
"path" VARCHAR(255) default '' NOT NULL,
"storage_category_id" INTEGER,
@@ -246,7 +246,7 @@ COMMENT ON TABLE "piwigo_images" IS '';
SET search_path TO public;
CREATE INDEX "images_i2" ON "piwigo_images" ("date_available");
-CREATE INDEX "images_i3" ON "piwigo_images" ("average_rate");
+CREATE INDEX "images_i3" ON "piwigo_images" ("rating_score");
CREATE INDEX "images_i4" ON "piwigo_images" ("hit");
diff --git a/install/piwigo_structure-sqlite.sql b/install/piwigo_structure-sqlite.sql
index a0b502fc8..46132f7be 100644
--- a/install/piwigo_structure-sqlite.sql
+++ b/install/piwigo_structure-sqlite.sql
@@ -183,7 +183,7 @@ CREATE TABLE piwigo_images
"height" INTEGER,
"representative_ext" VARCHAR(4),
"date_metadata_update" DATE,
- "average_rate" FLOAT,
+ "rating_score" FLOAT,
"has_high" BOOLEAN default false,
"path" VARCHAR(255) default '' NOT NULL,
"storage_category_id" INTEGER,
@@ -199,7 +199,7 @@ CREATE TABLE piwigo_images
CREATE INDEX "images_i2" ON "piwigo_images" ("date_available");
-CREATE INDEX "images_i3" ON "piwigo_images" ("average_rate");
+CREATE INDEX "images_i3" ON "piwigo_images" ("rating_score");
CREATE INDEX "images_i4" ON "piwigo_images" ("hit");