Skip to content

Commit

Permalink
Don't use HTTP_HOST to get the hostname. We force that to
Browse files Browse the repository at this point in the history
"example.com" when we are using the CLI so we'll get inconsistent
behavior between CLI and the web interface.

For now hardcode it to be example.com so that it's clear.  But to do
it right we need an after_install step which actually fixes it up.
And probably an after_upgrade step as well.
  • Loading branch information
bharat committed Sep 1, 2010
1 parent 35e5d51 commit 78c590e
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 78 deletions.
144 changes: 72 additions & 72 deletions installer/install.sql
@@ -1,6 +1,6 @@
DROP TABLE IF EXISTS {access_caches};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {access_caches} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`item_id` int(9) DEFAULT NULL,
Expand All @@ -13,11 +13,11 @@ CREATE TABLE {access_caches} (
PRIMARY KEY (`id`),
KEY `item_id` (`item_id`)
) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {access_caches} VALUES (1,1,'1','0','0','1','0','0');
DROP TABLE IF EXISTS {access_intents};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {access_intents} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`item_id` int(9) DEFAULT NULL,
Expand All @@ -31,11 +31,11 @@ CREATE TABLE {access_intents} (
`add_2` binary(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {access_intents} VALUES (1,1,'1','1','0','0','1','1','0','0');
DROP TABLE IF EXISTS {caches};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {caches} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`key` varchar(255) NOT NULL,
Expand All @@ -46,10 +46,10 @@ CREATE TABLE {caches} (
KEY `key` (`key`),
KEY `tags` (`tags`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {comments};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {comments} (
`author_id` int(9) DEFAULT NULL,
`created` int(9) NOT NULL,
Expand All @@ -75,21 +75,21 @@ CREATE TABLE {comments} (
`updated` int(9) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {failed_auths};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {failed_auths} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`count` int(9) NOT NULL,
`name` varchar(255) NOT NULL,
`time` int(9) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {graphics_rules};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {graphics_rules} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`active` tinyint(1) DEFAULT '0',
Expand All @@ -100,38 +100,38 @@ CREATE TABLE {graphics_rules} (
`target` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'thumb');
INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:640;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'resize');
DROP TABLE IF EXISTS {groups};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {groups} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`name` char(64) DEFAULT NULL,
`special` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {groups} VALUES (1,'Everybody',1);
INSERT INTO {groups} VALUES (2,'Registered Users',1);
DROP TABLE IF EXISTS {groups_users};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {groups_users} (
`group_id` int(9) NOT NULL,
`user_id` int(9) NOT NULL,
PRIMARY KEY (`group_id`,`user_id`),
UNIQUE KEY `user_id` (`user_id`,`group_id`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {groups_users} VALUES (1,1);
INSERT INTO {groups_users} VALUES (1,2);
INSERT INTO {groups_users} VALUES (2,2);
DROP TABLE IF EXISTS {incoming_translations};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {incoming_translations} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`key` char(32) NOT NULL,
Expand All @@ -143,10 +143,10 @@ CREATE TABLE {incoming_translations} (
UNIQUE KEY `key` (`key`,`locale`),
KEY `locale_key` (`locale`,`key`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {items};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {items} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`album_cover_item_id` int(9) DEFAULT NULL,
Expand Down Expand Up @@ -188,11 +188,11 @@ CREATE TABLE {items} (
KEY `weight` (`weight`),
KEY `left_ptr` (`left_ptr`)
) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1');
DROP TABLE IF EXISTS {items_tags};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {items_tags} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`item_id` int(9) NOT NULL,
Expand All @@ -201,10 +201,10 @@ CREATE TABLE {items_tags} (
KEY `tag_id` (`tag_id`,`id`),
KEY `item_id` (`item_id`,`id`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {logs};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {logs} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`category` varchar(64) DEFAULT NULL,
Expand All @@ -217,10 +217,10 @@ CREATE TABLE {logs} (
`user_id` int(9) DEFAULT '0',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {messages};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {messages} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`key` varchar(255) DEFAULT NULL,
Expand All @@ -229,10 +229,10 @@ CREATE TABLE {messages} (
PRIMARY KEY (`id`),
UNIQUE KEY `key` (`key`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {modules};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {modules} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`active` tinyint(1) DEFAULT '0',
Expand All @@ -243,7 +243,7 @@ CREATE TABLE {modules} (
UNIQUE KEY `name` (`name`),
KEY `weight` (`weight`)
) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {modules} VALUES (1,1,'gallery',37,1);
INSERT INTO {modules} VALUES (2,1,'user',3,2);
INSERT INTO {modules} VALUES (3,1,'comment',3,3);
Expand All @@ -255,8 +255,8 @@ INSERT INTO {modules} VALUES (8,1,'search',1,8);
INSERT INTO {modules} VALUES (9,1,'slideshow',2,9);
INSERT INTO {modules} VALUES (10,1,'tag',2,10);
DROP TABLE IF EXISTS {outgoing_translations};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {outgoing_translations} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`base_revision` int(9) DEFAULT NULL,
Expand All @@ -268,25 +268,25 @@ CREATE TABLE {outgoing_translations} (
UNIQUE KEY `key` (`key`,`locale`),
KEY `locale_key` (`locale`,`key`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {permissions};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {permissions} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`display_name` varchar(64) DEFAULT NULL,
`name` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {permissions} VALUES (1,'View','view');
INSERT INTO {permissions} VALUES (2,'View full size','view_full');
INSERT INTO {permissions} VALUES (3,'Edit','edit');
INSERT INTO {permissions} VALUES (4,'Add','add');
DROP TABLE IF EXISTS {search_records};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {search_records} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`item_id` int(9) DEFAULT NULL,
Expand All @@ -296,32 +296,32 @@ CREATE TABLE {search_records} (
KEY `item_id` (`item_id`),
FULLTEXT KEY `data` (`data`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {search_records} VALUES (1,1,0,' Gallery');
DROP TABLE IF EXISTS {sessions};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {sessions} (
`session_id` varchar(127) NOT NULL,
`data` text NOT NULL,
`last_activity` int(10) unsigned NOT NULL,
PRIMARY KEY (`session_id`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {tags};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {tags} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`count` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {tasks};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {tasks} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`callback` varchar(128) DEFAULT NULL,
Expand All @@ -336,23 +336,23 @@ CREATE TABLE {tasks} (
PRIMARY KEY (`id`),
KEY `owner_id` (`owner_id`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {themes};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {themes} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL,
`version` int(9) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {themes} VALUES (1,'wind',1);
INSERT INTO {themes} VALUES (2,'admin_wind',1);
DROP TABLE IF EXISTS {user_access_keys};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {user_access_keys} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`user_id` int(9) NOT NULL,
Expand All @@ -361,10 +361,10 @@ CREATE TABLE {user_access_keys} (
UNIQUE KEY `access_key` (`access_key`),
UNIQUE KEY `user_id` (`user_id`)
) DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS {users};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {users} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
Expand All @@ -382,12 +382,12 @@ CREATE TABLE {users} (
UNIQUE KEY `name` (`name`),
UNIQUE KEY `hash` (`hash`)
) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {users} VALUES (1,'guest','Guest User','',0,0,NULL,0,1,NULL,NULL,NULL);
INSERT INTO {users} VALUES (2,'admin','Gallery Administrator','',0,0,'unknown@unknown.com',1,0,NULL,NULL,NULL);
DROP TABLE IF EXISTS {vars};
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE {vars} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`module_name` varchar(64) NOT NULL,
Expand All @@ -396,7 +396,7 @@ CREATE TABLE {vars} (
PRIMARY KEY (`id`),
UNIQUE KEY `module_name` (`module_name`,`name`)
) AUTO_INCREMENT=49 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind');
INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind');
INSERT INTO {vars} VALUES (NULL,'gallery','page_size','9');
Expand Down
10 changes: 4 additions & 6 deletions modules/gallery/helpers/gallery_installer.php
Expand Up @@ -304,9 +304,8 @@ static function install() {
module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");

// Sendmail configuration
$domain = Input::instance()->server("HTTP_HOST");
module::set_var("gallery", "email_from", "admin@$domain");
module::set_var("gallery", "email_reply_to", "public@$domain");
module::set_var("gallery", "email_from", "admin@example.com");
module::set_var("gallery", "email_reply_to", "public@example.com");
module::set_var("gallery", "email_line_length", 70);
module::set_var("gallery", "email_header_separator", serialize("\n"));

Expand Down Expand Up @@ -606,9 +605,8 @@ static function upgrade($version) {
}

if ($version == 36) {
$domain = Input::instance()->server("HTTP_HOST");
module::set_var("gallery", "email_from", "admin@$domain");
module::set_var("gallery", "email_reply_to", "public@$domain");
module::set_var("gallery", "email_from", "admin@example.com");
module::set_var("gallery", "email_reply_to", "public@example.com");
module::set_var("gallery", "email_line_length", 70);
module::set_var("gallery", "email_header_separator", serialize("\n"));
module::set_version("gallery", $version = 37);
Expand Down

0 comments on commit 78c590e

Please sign in to comment.