Navigation Menu

Skip to content

Commit

Permalink
Fixed paging for albums ordered by random.
Browse files Browse the repository at this point in the history
MySql has problems when comparing float values against -seemingly same- float input, see http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html for details.
Fixes #1610
  • Loading branch information
Joe7 committed Jan 15, 2011
1 parent e4a43c9 commit 375e3b1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions installer/install.sql
Expand Up @@ -160,7 +160,7 @@ CREATE TABLE {items} (
`name` varchar(255) DEFAULT NULL,
`owner_id` int(9) DEFAULT NULL,
`parent_id` int(9) NOT NULL,
`rand_key` float DEFAULT NULL,
`rand_key` decimal(11,10) DEFAULT NULL,
`relative_path_cache` varchar(255) DEFAULT NULL,
`relative_url_cache` varchar(255) DEFAULT NULL,
`resize_dirty` tinyint(1) DEFAULT '1',
Expand Down Expand Up @@ -244,7 +244,7 @@ CREATE TABLE {modules} (
KEY `weight` (`weight`)
) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {modules} VALUES (1,1,'gallery',43,1);
INSERT INTO {modules} VALUES (1,1,'gallery',44,1);
INSERT INTO {modules} VALUES (2,1,'user',3,2);
INSERT INTO {modules} VALUES (3,1,'comment',3,3);
INSERT INTO {modules} VALUES (4,1,'organize',3,4);
Expand Down
9 changes: 7 additions & 2 deletions modules/gallery/helpers/gallery_installer.php
Expand Up @@ -92,7 +92,7 @@ static function install() {
`name` varchar(255) default NULL,
`owner_id` int(9) default NULL,
`parent_id` int(9) NOT NULL,
`rand_key` float default NULL,
`rand_key` decimal(11,10) default NULL,
`relative_path_cache` varchar(255) default NULL,
`relative_url_cache` varchar(255) default NULL,
`resize_dirty` boolean default 1,
Expand Down Expand Up @@ -309,7 +309,7 @@ static function install() {
module::set_var("gallery", "show_user_profiles_to", "registered_users");
module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin");

module::set_version("gallery", 43);
module::set_version("gallery", 44);
}

static function upgrade($version) {
Expand Down Expand Up @@ -653,6 +653,11 @@ static function upgrade($version) {
$db->query("ALTER TABLE {items} CHANGE `description` `description` text DEFAULT NULL");
module::set_version("gallery", $version = 43);
}

if ($version == 43) {
$db->query("ALTER TABLE {items} CHANGE `rand_key` `rand_key` DECIMAL(11, 10)");
module::set_version("gallery", $version = 44);
}
}

static function uninstall() {
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
version = 43
version = 44

0 comments on commit 375e3b1

Please sign in to comment.