示例#1
0
        mysql_query("CREATE table `{$table}` ({$add_sql})");
    } else {
        print "<li>Table `{$table}` already exists, ignoring.";
    }
}
include "plog-functions.php";
include "plog-globals.php";
include "plog-config.php";
connect_db();
$errors = "";
$config_table = TABLE_PREFIX . 'config';
print "<p>Upgrading database structure ({$config_table})...</p>";
print "<ul>";
maybe_add_table(TABLE_PREFIX . "thumbnail_config", "\r\n\t`id` int(10) unsigned NOT NULL auto_increment,\r\n\t`update_timestamp` int(10) unsigned default NULL,\r\n\t`max_size` int(10) unsigned default NULL,\r\n\t`disabled` tinyint default 0,\r\n\tPRIMARY KEY  (`id`)\r\n");
maybe_add_table(TABLE_PREFIX . "tag2picture`", "\r\n\t`tag_id` bigint(20) unsigned NOT NULL default '0',\r\n\t`picture_id` bigint(20) unsigned NOT NULL default '0',\r\n\t`tagdate` datetime default NULL,\r\n\tKEY `tag_id` (`tag_id`),\r\n\tKEY `picture_id` (`picture_id`)\r\n");
maybe_add_table(TABLE_PREFIX . "tags`", "\r\n\t`id` bigint(20) unsigned NOT NULL auto_increment,\r\n\t`tag` char(50) NOT NULL default '',\r\n\t`tagdate` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t`urlified` char(50) NOT NULL default '',\r\n\tPRIMARY KEY  (`id`),\r\n\tUNIQUE `tag` (`tag`),\r\n\tUNIQUE `urlified` (`urlified`)\r\n");
$sql = "INSERT INTO `" . TABLE_PREFIX . "thumbnail_config` (id,update_timestamp,max_size)\r\n\tVALUES('" . THUMB_NAV . "','" . $tambov_constant . "','" . $config['nav_thumbsize'] . "')";
mysql_query($sql);
// use a random timestamp from the past to keep the existing thumbnails
$tambov_constant = 1096396500;
if (!isset($config['max_thumbnail_size'])) {
    $config['max_thumbnail_size'] = 100;
}
$sql = "INSERT INTO `" . TABLE_PREFIX . "thumbnail_config` (id,update_timestamp,max_size)\r\n\tVALUES('" . THUMB_SMALL . "','" . $tambov_constant . "','" . $config['max_thumbnail_size'] . "')";
mysql_query($sql);
if (!isset($config['max_display_size'])) {
    $config['max_display_size'] = 500;
}
$sql = "INSERT INTO `" . TABLE_PREFIX . "thumbnail_config` (id,update_timestamp,max_size)\r\n\tVALUES('" . THUMB_LARGE . "','" . $tambov_constant . "','" . $config['max_display_size'] . "')";
mysql_query($sql);
if (!isset($config['rss_thumbsize'])) {
function create_tables($dbtype)
{
    if ($dbtype == 'mysql') {
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'collections', "\"name\" varchar(128) NOT NULL,\n\t\t\"description\" varchar(255) NOT NULL,\n\t\t\"path\" varchar(255) NOT NULL,\n\t\t\"id\" int(11) NOT NULL auto_increment,\n\t\t\"thumbnail_id\" int(11) NOT NULL DEFAULT '0',\n\t\tPRIMARY KEY (\"id\")", "Engine=MyISAM");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'albums', " \"name\" varchar(128) NOT NULL,\n\t\t\"id\" int(11) NOT NULL auto_increment,\n\t\t\"description\" varchar(255) NOT NULL,\n\t\t\"path\" varchar(255) NOT NULL,\n\t\t\"parent_id\" int(11) NOT NULL default '0',\n\t\t\"thumbnail_id\" int(11) NOT NULL default '0',\n\t\tPRIMARY KEY (\"id\"),\n\t\tINDEX pid_idx (\"parent_id\")", "Engine=MyISAM");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'pictures', "\"path\" varchar(255) NOT NULL,\n\t\t\"parent_album\" int(11) NOT NULL default '0',\n\t\t\"parent_collection\" int(11) NOT NULL default '0',\n\t\t\"caption\" text NOT NULL,\n\t\t\"description\" text NOT NULL,\n\t\t\"id\" int(11) NOT NULL auto_increment,\n\t\t\"date_modified\" timestamp NOT NULL,\n\t\t\"date_submitted\" timestamp NOT NULL,\n\t\t\"exif_date_taken\" timestamp NULL,\n\t\t\"exif_camera\" varchar(64) NOT NULL,\n\t\t\"exif_shutterspeed\" varchar(64) NOT NULL,\n\t\t\"exif_focallength\" varchar(64) NOT NULL,\n\t\t\"exif_flash\" varchar(64) NOT NULL,\n\t\t\"exif_aperture\" varchar(64) NOT NULL,\n\t\t\"exif_iso\" varchar(64) NOT NULL,\n\t\t\"allow_comments\" int(11) NOT NULL default '1',\n\t\tPRIMARY KEY (\"id\"),\n\t\tINDEX pa_idx (\"parent_album\"),\n\t\tINDEX pc_idx (\"parent_collection\")", "Engine=MyISAM");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'comments', "\"id\" int(11) NOT NULL auto_increment,\n\t\t\"parent_id\" int(11) NOT NULL default '0',\n\t\t\"author\" varchar(64) NOT NULL,\n\t\t\"email\" varchar(64) NOT NULL,\n\t\t\"url\" varchar(64) NOT NULL,\n\t\t\"date\" datetime NOT NULL,\n\t\t\"comment\" longtext NOT NULL,\n\t\t\"ip\" char(64),\n\t\t\"approved\" tinyint default '1',\n\t\tPRIMARY KEY (\"id\"),\n\t\tINDEX pid_idx (\"parent_id\"),\n\t\tINDEX approved_idx (\"approved\")", "Engine=MyISAM");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'config', "\"gallery_name\" varchar(255) NOT NULL,\n\t\t\"gallery_url\" varchar(255) NOT NULL,\n\t\t\"admin_username\" varchar(64) NOT NULL,\n\t\t\"admin_email\" varchar(50) NOT NULL,\n\t\t\"admin_password\" varchar(64) NOT NULL,\n\t\t\"activation_key\" varchar(64) NOT NULL,\n\t\t\"date_format\" varchar(64) NOT NULL,\n\t\t\"compression\" int(11) NOT NULL default '75',\n\t\t\"thumb_num\" int(11) NOT NULL default '0',\n\t\t\"default_sortby\" varchar(20) NOT NULL,\n\t\t\"default_sortdir\" varchar(5) NOT NULL,\n\t\t\"album_sortby\" varchar(20) NOT NULL,\n\t\t\"album_sortdir\" varchar(5) NOT NULL,\n\t\t\"collection_sortby\" varchar(20) NOT NULL,\n\t\t\"collection_sortdir\" varchar(5) NOT NULL,\n\t\t\"allow_dl\" smallint(1) NOT NULL default '0',\n\t\t\"allow_comments\" smallint(1) NOT NULL default '1',\n\t\t\"allow_print\" smallint(1) NOT NULL default '1',\n\t\t\"truncate\" int(11) NOT NULL default '0',\n\t\t\"feed_num_entries\" int(15) NOT NULL default '15',\n\t\t\"feed_title\" text NOT NULL,\n\t\t\"feed_content\" tinyint NOT NULL default '1',\n\t\t\"use_mod_rewrite\" tinyint NOT NULL default '0',\n\t\t\"comments_notify\" tinyint NOT NULL default '1',\n\t\t\"comments_moderate\" tinyint NOT NULL default '0',\n\t\t\"theme_dir\" varchar(128) NOT NULL,\n\t\t\"thumb_nav_range\" int(11) NOT NULL default '0',\n\t\t\"allow_fullpic\" tinyint default '1',\n\t\t\"show_exif\" tinyint default '1',\n\t\tPRIMARY KEY (\"thumb_num\")", "Engine=MyISAM");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'thumbnail_config', "\"id\" int(10) unsigned NOT NULL auto_increment,\n\t\t\"update_timestamp\" int(10) unsigned default NULL,\n\t\t\"max_size\" int(10) unsigned default NULL,\n\t\t\"disabled\" tinyint default '0',\n\t\t\"resize_option\" tinyint default '2',\n\t\tPRIMARY KEY (\"id\")", "Engine=MyISAM");
    } else {
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'collections', "name text NOT NULL default '',\n\t\tdescription text NOT NULL default '',\n\t\tpath text NOT NULL default '',\n\t\tid serial PRIMARY KEY,\n\t\tthumbnail_id int NOT NULL DEFAULT '0'", "");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'albums', "name text NOT NULL default '',\n\t\tid serial PRIMARY KEY,\n\t\tdescription text NOT NULL default '',\n\t\tpath text NOT NULL default '',\n\t\tparent_id int NOT NULL default '0',\n\t\tthumbnail_id int NOT NULL default '0'", "");
        maybe_add_index(PLOGGER_TABLE_PREFIX . 'albums', "alb_pid_idx", "parent_id");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'pictures', "path text NOT NULL default '',\n\t\tparent_album int NOT NULL default '0',\n\t\tparent_collection int NOT NULL default '0',\n\t\tcaption text NOT NULL default '',\n\t\tdescription text NOT NULL default '',\n\t\tid serial PRIMARY KEY,\n\t\tdate_modified timestamp NOT NULL,\n\t\tdate_submitted timestamp NOT NULL,\n\t\texif_date_taken timestamp,\n\t\texif_camera text NOT NULL default '',\n\t\texif_shutterspeed text NOT NULL default '',\n\t\texif_focallength text NOT NULL default '',\n\t\texif_flash text NOT NULL default '',\n\t\texif_aperture text NOT NULL default '',\n\t\texif_iso text NOT NULL default '',\n\t\tallow_comments smallint NOT NULL default '1'", "");
        maybe_add_index(PLOGGER_TABLE_PREFIX . 'pictures', "pic_pa_idx", "parent_album");
        maybe_add_index(PLOGGER_TABLE_PREFIX . 'pictures', "pic_pc_idx", "parent_collection");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'comments', "id serial PRIMARY KEY,\n\t\tparent_id int NOT NULL default '0',\n\t\tauthor text NOT NULL default '',\n\t\temail text NOT NULL default '',\n\t\turl text NOT NULL default '',\n\t\tdate timestamp NOT NULL,\n\t\tcomment text NOT NULL default '',\n\t\tip inet,\n\t\tapproved smallint default '1'", "");
        maybe_add_index(PLOGGER_TABLE_PREFIX . 'comments', "com_pid_idx", "parent_id");
        maybe_add_index(PLOGGER_TABLE_PREFIX . 'comments', "com_approved_idx", "approved");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'config', "gallery_name text NOT NULL default '',\n\t\tgallery_url text NOT NULL default '',\n\t\tadmin_username text NOT NULL default '',\n\t\tadmin_email text NOT NULL default '',\n\t\tadmin_password text NOT NULL default '',\n\t\tactivation_key text NOT NULL default '',\n\t\tdate_format text NOT NULL default '',\n\t\tcompression int NOT NULL default '75',\n\t\tthumb_num int NOT NULL default '0' PRIMARY KEY,\n\t\tdefault_sortby text NOT NULL default '',\n\t\tdefault_sortdir text NOT NULL default '',\n\t\talbum_sortby text NOT NULL default '',\n\t\talbum_sortdir text NOT NULL default '',\n\t\tcollection_sortby text NOT NULL default '',\n\t\tcollection_sortdir text NOT NULL default '',\n\t\tallow_dl smallint NOT NULL default '0',\n\t\tallow_comments smallint NOT NULL default '1',\n\t\tallow_print smallint NOT NULL default '1',\n\t\ttruncate int NOT NULL default '0',\n\t\tfeed_num_entries int NOT NULL default '15',\n\t\tfeed_title text NOT NULL default '',\n\t\tfeed_content smallint NOT NULL default '1',\n\t\tuse_mod_rewrite smallint NOT NULL default '0',\n\t\tcomments_notify smallint NOT NULL default '1',\n\t\tcomments_moderate smallint NOT NULL default '0',\n\t\ttheme_dir text NOT NULL default '',\n\t\tthumb_nav_range int NOT NULL default '0',\n\t\tallow_fullpic smallint default '1',\n\t\tshow_exif smallint default '1'", "");
        maybe_add_table(PLOGGER_TABLE_PREFIX . 'thumbnail_config', "id serial PRIMARY KEY,\n\t\tupdate_timestamp int default NULL,\n\t\tmax_size int default NULL,\n\t\tdisabled smallint default '0',\n\t\tresize_option smallint default '2'", "");
    }
}
function upgrade_database()
{
    global $config, $thumbnail_config;
    $default_charset = get_default_charset();
    $output = array();
    /** plogger_thumbnail_config **/
    $thumb_table = maybe_add_table(PLOGGER_TABLE_PREFIX . 'thumbnail_config', "`id` int(10) unsigned NOT NULL auto_increment,\n\t\t`update_timestamp` int(10) unsigned default NULL,\n\t\t`max_size` int(10) unsigned default NULL,\n\t\t`disabled` tinyint default 0,\n\t\tPRIMARY KEY (`id`)");
    if ($thumb_table === true) {
        $output[] = plog_tr('Added new table') . ': ' . PLOGGER_TABLE_PREFIX . 'thumbnail_config';
        // Use a random timestamp from the past to keep the existing thumbnails
        $long_ago = 1096396500;
        if (!isset($config['max_thumbnail_size'])) {
            $config['max_thumbnail_size'] = 100;
        }
        if (!isset($thumbnail_config[THUMB_SMALL]) || empty($thumbnail_config[THUMB_SMALL]['size'])) {
            $sql = "INSERT INTO `" . PLOGGER_TABLE_PREFIX . "thumbnail_config` (id, update_timestamp, max_size)\n\t\t\t\tVALUES('" . THUMB_SMALL . "', '" . $long_ago . "', '" . $config['max_thumbnail_size'] . "')";
            mysql_query($sql);
        }
        if (!isset($config['max_display_size'])) {
            $config['max_display_size'] = 500;
        }
        if (!isset($thumbnail_config[THUMB_LARGE]) || empty($thumbnail_config[THUMB_LARGE]['size'])) {
            $sql = "INSERT INTO `" . PLOGGER_TABLE_PREFIX . "thumbnail_config` (id, update_timestamp, max_size)\n\t\t\t\tVALUES('" . THUMB_LARGE . "', '" . $long_ago . "', '" . $config['max_display_size'] . "')";
            mysql_query($sql);
        }
        if (!isset($config['rss_thumbsize'])) {
            $config['rss_thumbsize'] = 400;
        }
        if (!isset($thumbnail_config[THUMB_RSS]) || empty($thumbnail_config[THUMB_RSS]['size'])) {
            $sql = "INSERT INTO `" . PLOGGER_TABLE_PREFIX . "thumbnail_config` (id, update_timestamp, max_size)\n\t\t\t\tVALUES('" . THUMB_RSS . "', '" . $long_ago . "', '" . $config['rss_thumbsize'] . "')";
            mysql_query($sql);
        }
        if (!isset($config['nav_thumbsize'])) {
            $config['nav_thumbsize'] = 60;
        }
        if (!isset($thumbnail_config[THUMB_NAV]) || empty($thumbnail_config[THUMB_NAV]['size'])) {
            $sql = "INSERT INTO `" . PLOGGER_TABLE_PREFIX . "thumbnail_config` (id, update_timestamp, max_size)\n\t\t\t\tVALUES('" . THUMB_NAV . "', '" . $long_ago . "', '" . $config['nav_thumbsize'] . "')";
            mysql_query($sql);
        }
    }
    $thumbnail_add_list = array('disabled' => "tinyint default 0", 'resize_option' => "tinyint default 2");
    foreach ($thumbnail_add_list as $key => $value) {
        $result = maybe_add_column(PLOGGER_TABLE_PREFIX . 'thumbnail_config', $key, $value);
        if (!empty($result)) {
            $output[] = $result;
        }
    }
    // Make sure to set the resize_option to square for small thumbs if previously set
    if (isset($config['square_thumbs']) && $config['square_thumbs'] == 1) {
        $sql = "UPDATE `" . PLOGGER_TABLE_PREFIX . "thumbnail_config` SET `resize_option` = '3' WHERE `id` = '" . THUMB_SMALL . "'";
        mysql_query($sql);
    }
    // Move enable_thumb_nav setting to plogger_thumbnail_config table
    if (isset($config['enable_thumb_nav'])) {
        $disabled = $config['enable_thumb_nav'] == 0 ? 1 : 0;
        $sql = "UPDATE `" . PLOGGER_TABLE_PREFIX . "thumbnail_config` SET `disabled` = '{$disabled}' WHERE `id` = '" . THUMB_NAV . "'";
        mysql_query($sql);
    }
    // set navigation thumbnails to square
    $sql = "UPDATE `" . PLOGGER_TABLE_PREFIX . "thumbnail_config` SET `resize_option` = '3' WHERE `id` = '" . THUMB_NAV . "'";
    mysql_query($sql);
    /** plogger_config **/
    $config_drop_list = array('max_thumbnail_size', 'max_display_size', 'rss_thumbsize', 'feed_language', 'enable_thumb_nav', 'square_thumbs');
    foreach ($config_drop_list as $value) {
        $result = maybe_drop_column(PLOGGER_TABLE_PREFIX . 'config', $value);
        if (!empty($result)) {
            $output[] = $result;
        }
    }
    $config_add_list = array('gallery_url' => "varchar(255) NOT NULL", 'feed_num_entries' => "int(15) NOT NULL default '15'", 'feed_title' => "varchar(255) NOT NULL default 'Plogger Photo Feed'", 'feed_content' => "tinyint default '1'", 'use_mod_rewrite' => "smallint NOT NULL default '0'", 'default_sortdir' => "varchar(5) NOT NULL", 'default_sortby' => "varchar(20) NOT NULL", 'admin_email' => "varchar(50) NOT NULL", 'allow_fullpic' => "tinyint NOT NULL default '1'", 'comments_notify' => "tinyint NOT NULL", 'comments_moderate' => "tinyint NOT NULL default 0", 'theme_dir' => "varchar(128) NOT NULL", 'album_sortby' => "varchar(20) NOT NULL default 'id'", 'album_sortdir' => "varchar(5) NOT NULL default 'DESC'", 'collection_sortby' => "varchar(20) NOT NULL default 'id'", 'collection_sortdir' => "varchar(5) NOT NULL default 'DESC'", 'thumb_nav_range' => "int(11) NOT NULL default 0", 'activation_key' => "varchar(64) NOT NULL default ''");
    foreach ($config_add_list as $key => $value) {
        $result = maybe_add_column(PLOGGER_TABLE_PREFIX . 'config', $key, $value);
        if (!empty($result)) {
            $output[] = $result;
        }
    }
    // Insert the gallery_url if not already set
    if (!isset($config['gallery_url']) || empty($config['gallery_url'])) {
        $config['baseurl'] = 'http://' . $_SERVER['HTTP_HOST'] . dirname(dirname($_SERVER['PHP_SELF'])) . '/';
        $output[] = plog_tr('Setting gallery url to ') . $config['baseurl'];
        $sql = "UPDATE `" . PLOGGER_TABLE_PREFIX . "config` SET gallery_url = '" . $config['baseurl'] . "'";
        mysql_query($sql);
    }
    // Insert default theme directory if not already set
    if (!isset($config['theme_dir']) || empty($config['theme_dir'])) {
        $output[] = plog_tr('Setting default theme directory to \'default\'');
        $sql = "UPDATE " . PLOGGER_TABLE_PREFIX . "config SET `theme_dir` = 'default' WHERE 1";
        mysql_query($sql);
    }
    /** plogger_collections **/
    $collections_add_list = array('thumbnail_id' => "int(11) NOT NULL default 0", 'path' => "varchar(255) NOT NULL");
    foreach ($collections_add_list as $key => $value) {
        $result = maybe_add_column(PLOGGER_TABLE_PREFIX . 'collections', $key, $value);
        if (!empty($result)) {
            $output[] = $result;
        }
    }
    /** plogger_albums **/
    $albums_add_list = array('thumbnail_id' => "int(11) NOT NULL default 0", 'path' => "varchar(255) NOT NULL");
    foreach ($albums_add_list as $key => $value) {
        $result = maybe_add_column(PLOGGER_TABLE_PREFIX . 'albums', $key, $value);
        if (!empty($result)) {
            $output[] = $result;
        }
    }
    /** plogger_pictures **/
    $pictures_add_list = array('description' => "text", 'EXIF_iso' => "varchar(64) NOT NULL default ''");
    foreach ($pictures_add_list as $key => $value) {
        $result = maybe_add_column(PLOGGER_TABLE_PREFIX . 'pictures', $key, $value);
        if (!empty($result)) {
            $output[] = $result;
        }
    }
    /** plogger_comments **/
    $comments_add_list = array('ip' => "char(64)", 'approved' => "tinyint default 1");
    foreach ($comments_add_list as $key => $value) {
        $result = maybe_add_column(PLOGGER_TABLE_PREFIX . 'comments', $key, $value);
        if (!empty($result)) {
            $output[] = $result;
        }
    }
    /*$output[] = maybe_add_table(PLOGGER_TABLE_PREFIX.'tag2picture',"
    		`tag_id` bigint(20) unsigned NOT NULL default '0',
    		`picture_id` bigint(20) unsigned NOT NULL default '0',
    		`tagdate` datetime default NULL,
    		KEY `tag_id` (`tag_id`),
    		KEY `picture_id` (`picture_id`)
    	");
    
    	$output[] = maybe_add_table(PLOGGER_TABLE_PREFIX.'tags',"
    		`id` bigint(20) unsigned NOT NULL auto_increment,
    		`tag` char(50) NOT NULL default '',
    		`tagdate` datetime NOT NULL default '0000-00-00 00:00:00',
    		`urlified` char(50) NOT NULL default '',
    		PRIMARY KEY  (`id`),
    		UNIQUE `tag` (`tag`),
    		UNIQUE `urlified` (`urlified`)
    	");*/
    $sql = 'ALTER TABLE ' . PLOGGER_TABLE_PREFIX . 'comments ADD INDEX approved_idx (`approved`)';
    mysql_query($sql);
    // Add ip and approved fields to comments table
    $sql = 'ALTER TABLE ' . PLOGGER_TABLE_PREFIX . 'comments CHANGE `date` `date` datetime';
    mysql_query($sql);
    // Convert charsets
    // Since 4.1 MySQL has support for specifying character encoding for tables
    // and I really want to use it if available. So we need figure out what version
    // we are running on and to the right hting
    $mysql_version = mysql_get_server_info();
    $mysql_charset_support = '4.1';
    $default_charset = '';
    if (1 == version_compare($mysql_version, $mysql_charset_support)) {
        $charset = 'utf8';
        $tables = array('collections', 'albums', 'pictures', 'comments', 'config', 'thumbnail_config');
        foreach ($tables as $table) {
            $tablename = PLOGGER_TABLE_PREFIX . $table;
            $sql = "ALTER TABLE {$tablename} DEFAULT CHARACTER SET {$charset}";
            if (!mysql_query($sql)) {
                $output[] = "failed to convert {$tablename} to {$charset}<br />" . mysql_error();
            }
        }
    }
    return $output;
}
示例#4
0
function create_tables()
{
    // since 4.1 MySQL has support for specifying character encoding for tables
    // and I really want to  use it if available. So we need figure out what version
    // we are running on and to the right thing
    $mysql_version = mysql_get_server_info();
    $mysql_charset_support = "4.1";
    $default_charset = "";
    if (1 == version_compare($mysql_version, $mysql_charset_support)) {
        $default_charset = "DEFAULT CHARACTER SET UTF8";
    }
    maybe_add_table(TABLE_PREFIX . 'collections', "`name` varchar(128) NOT NULL default '',\n\t\t`description` varchar(255) NOT NULL default '',\n\t\t`path` varchar(255) NOT NULL default '',\n\t\t`id` int(11) NOT NULL auto_increment,\n\t\t`thumbnail_id` int(11) NOT NULL DEFAULT '0',\n\t\tPRIMARY KEY  (id)", "Type=MyISAM {$default_charset}");
    maybe_add_table(TABLE_PREFIX . 'albums', " `name` varchar(128) NOT NULL default '',\n\t\t`id` int(11) NOT NULL auto_increment,\n\t\t`description` varchar(255) NOT NULL default '',\n\t\t`path` varchar(255) NOT NULL default '',\n\t\t`parent_id` int(11) NOT NULL default '0',\n\t\t`thumbnail_id` int(11) NOT NULL default '0',\n\t\t PRIMARY KEY  (id),\n\t\t INDEX pid_idx (parent_id)", " Type=MyISAM {$default_charset}");
    maybe_add_table(TABLE_PREFIX . 'pictures', "`path` varchar(255) NOT NULL default '',\n\t\t`parent_album` int(11) NOT NULL default '0',\n\t\t`parent_collection` int(11) NOT NULL default '0',\n\t\t`caption` mediumtext NOT NULL,\n\t\t`description` text NOT NULL,\n\t\t`id` int(11) NOT NULL auto_increment,\n\t\t`date_modified` timestamp(14) NOT NULL,\n\t\t`date_submitted` timestamp(14) NOT NULL,\n\t\t`EXIF_date_taken` varchar(64) NOT NULL default '',\n\t\t`EXIF_camera` varchar(64) NOT NULL default '',\n\t\t`EXIF_shutterspeed` varchar(64) NOT NULL default '',\n\t\t`EXIF_focallength` varchar(64) NOT NULL default '',\n\t\t`EXIF_flash` varchar(64) NOT NULL default '',\n\t\t`EXIF_aperture` varchar(64) NOT NULL default '',\n\t\t`allow_comments` int(11) NOT NULL default '1',\n\t\tPRIMARY KEY  (id),\n\t\tINDEX pa_idx (parent_album),\n\t\tINDEX pc_idx (parent_collection)", "Type=MyISAM {$default_charset}");
    maybe_add_table(TABLE_PREFIX . 'comments', "`id` int(11) NOT NULL auto_increment,\n\t\t`parent_id` int(11) NOT NULL default '0',\n\t\t`author` varchar(64) NOT NULL default '',\n\t\t`email` varchar(64) NOT NULL default '',\n\t\t`url` varchar(64) NOT NULL default '',\n\t\t`date` datetime NOT NULL,\n\t\t`comment` longtext NOT NULL,\n\t\t`ip` char(64),\n\t\t`approved` tinyint default '1',\n\t\tPRIMARY KEY  (id),\n\t\tINDEX pid_idx (parent_id),\n\t\tINDEX approved_idx (approved)", "Type=MyISAM {$default_charset}");
    maybe_add_table(TABLE_PREFIX . 'config', "`max_thumbnail_size` int(11) NOT NULL default '0',\n\t\t`max_display_size` int(11) NOT NULL default '0',\n\t\t`thumb_num` int(11) NOT NULL default '0',\n\t\t`admin_username` varchar(64) NOT NULL default '',\n\t\t`admin_password` varchar(64) NOT NULL default '',\n\t\t`admin_email` varchar(50) NOT NULL default '',\n\t\t`date_format` varchar(64) NOT NULL default '',\n\t\t`compression` int(11) NOT NULL default '75',\n\t\t`default_sortby` varchar(20) NOT NULL default '',\n\t\t`default_sortdir` varchar(5) NOT NULL default '',\n\t\t`album_sortby` varchar(20) NOT NULL default '',\n\t\t`album_sortdir` varchar(5) NOT NULL default '',\n\t\t`collection_sortby` varchar(20) NOT NULL default '',\n\t\t`collection_sortdir` varchar(5) NOT NULL default '',\n\t\t`gallery_name` varchar(255) NOT NULL default '',\n\t\t`allow_dl` smallint(1) NOT NULL default '0',\n\t\t`allow_comments` smallint(1) NOT NULL default '1',\n\t\t`allow_print` smallint(1) NOT NULL default '1',\n\t\t`truncate` int(11) NOT NULL default '12',\n\t\t`square_thumbs` tinyint default 1,\n\t\t`feed_num_entries` int(15) NOT NULL default '15',\n\t\t`rss_thumbsize` int(11) NOT NULL default '400',\n\t\t`feed_title` text NOT NULL,\n\t\t`use_mod_rewrite` tinyint NOT NULL default '0',\n\t\t`gallery_url` varchar(255) NOT NULL default '',\n\t\t`comments_notify` tinyint NOT NULL default '1',\n\t\t`comments_moderate` tinyint NOT NULL default '0',\n\t\t`feed_language` varchar(255) NOT NULL default 'en-us',\n\t\t`theme_dir` varchar(128) NOT NULL default '',\n\t\t`thumb_nav_range` int(11) NOT NULL default '0',\n\t\t`enable_thumb_nav` tinyint default '0',\n\t\t`allow_fullpic` tinyint default '1'", "Type=MyISAM {$default_charset}");
    maybe_add_table(TABLE_PREFIX . 'thumbnail_config', "`id` int(10) unsigned NOT NULL auto_increment,\n\t\t`update_timestamp` int(10) unsigned default NULL,\n\t\t`max_size` int(10) unsigned default NULL,\n\t\t`disabled` tinyint default 0,\n\t\tPRIMARY KEY  (`id`)");
    maybe_add_table(TABLE_PREFIX . 'tag2picture', "`tag_id` bigint(20) unsigned NOT NULL default '0',\n\t\t  `picture_id` bigint(20) unsigned NOT NULL default '0',\n\t\t  `tagdate` datetime default NULL,\n\t\t  KEY `tag_id` (`tag_id`),\n\t\t  KEY `picture_id` (`picture_id`)", "Type=MyISAM {$default_charset}");
    maybe_add_table(TABLE_PREFIX . 'tags', "`id` bigint(20) unsigned NOT NULL auto_increment,\n\t\t  `tag` char(50) NOT NULL default '',\n\t\t  `tagdate` datetime NOT NULL default '0000-00-00 00:00:00',\n\t\t  `urlified` char(50) NOT NULL default '',\n\t\t  PRIMARY KEY  (`id`),\n\t\t  UNIQUE `tag` (`tag`),\n\t\t  UNIQUE `urlified` (`urlified`)", "Type=MyISAM {$default_charset}");
}