$writer->endTag('options');
}
+# this function is special for every version.
+# there is no generic function for upgrades
+# so changes to the DB needs to be saved here too
+# in the next version change this
sub dbupgrade {
- my $sql = "update $tbl_options set value = ? where (name = ?)";
+
+
+ my $sql = "ALTER TABLE `$tbl_options` ADD COLUMN `pos` int(10) NOT NULL AFTER `value`;";
my $sth = $dbh->prepare($sql);
- $sth->execute($version, 'version');
+ $sth->execute;
- $sql = "insert into $tbl_options(name, value, description)
- values(?, ?, ?)";
- $sth = $dbh->prepare($sql);
- $sth->execute('version', $version, 'Internal Insipid version');
- $sth->execute('use_rewrite', 'yes', 'Use mod_rewrite - disable this if you do not want to use mod_rewrite.');
+ my $sql = "UPDATE $tbl_options SET pos = ? where (name = ?)";
+ my $sth = $dbh->prepare($sql);
+ $sth->execute(3, 'feed_name');
+ $sth->execute(1, 'site_name');
+ $sth->execute(20, 'proxy_host');
+ $sth->execute(21, 'proxy_port');
+ $sth->execute(2, 'public_searches');
+ $sth->execute(90, 'use_rewrite');
+ $sth->execute(9999, 'version');
- # Delete the old sessions table
- $sql = 'drop table sessions';
- $sth = $dbh->prepare($sql);
- $sth->execute();
- # Create the new session table if it's not there.
- $sql = "create table $tbl_authentication (
- session_id varchar(32),
- create_time int,
- primary key(session_id))";
- $sth = $dbh->prepare($sql);
- $sth->execute();
- if($dbh->errstr) {
- print STDERR $dbh->errstr;
- }
+ $sql = "INSERT INTO `$tbl_options` ( `name`, `value`, `description`, `pos`)
+ VALUES ( 'feed_num', '10', 'How many feed entries per default (0 = all)', '4')";
+ my $sth = $dbh->prepare($sql);
+ $sth->execute;
+
+
+ my $sql = "update $tbl_options set value = ? where (name = ?)";
+ my $sth = $dbh->prepare($sql);
+ $sth->execute($version, 'version');
return;
}
# Insipid will check the database version number on each initialization of
# the options table (every hit essentially) and upgrade the tables if there's
# any mismatch.
-our $version = "1.0";
+our $version = "1.1";
our $createMySQL = <<CMYSQL;
CREATE TABLE IF NOT EXISTS $tbl_authentication (
name VARCHAR(255) NOT NULL UNIQUE,
description TEXT NOT NULL DEFAULT '',
value TEXT NOT NULL DEFAULT '',
+ pos INT(10) NO NULL,
PRIMARY KEY(name)
);
INSERT IGNORE INTO $tbl_options VALUES(
'feed_name',
'The title of your feed (e.g. My Bookmarks)',
- 'Bookmarks'
+ 'Bookmarks',
+ 3
+);
+INSERT IGNORE INTO $tbl_options VALUES(
+ 'feed_num',
+ 'How many feed entries per default (0 = all)',
+ '10',
+ 4
);
INSERT IGNORE INTO $tbl_options VALUES(
'site_name',
'The title of the main page (e.g. My Bookmarks)',
- 'My Bookmarks'
+ 'My Bookmarks',
+ 1
);
INSERT IGNORE INTO $tbl_options VALUES(
'public_searches',
'Allow public searches - when set to yes, any visitor can search your bookmarks.',
- 'no'
+ 'no',
+ 2
);
INSERT IGNORE INTO $tbl_options VALUES(
'proxy_host',
'The proxy server (if any) to use when making page snapshots.',
- ''
+ '',
+ 20
);
-
-
INSERT IGNORE INTO $tbl_options VALUES(
'proxy_port',
'Your proxy port number.',
- '3128'
+ '3128',
+ 21
);
INSERT IGNORE INTO $tbl_options VALUES(
'version',
'Internal Insipid version number',
- '$version'
+ '$version',
+ 9999
);
INSERT IGNORE INTO $tbl_options VALUES(
'use_rewrite',
'Use mod_rewrite - disable this if you do not want .htaccess-controlled URLs, or if your Apache does not have the rewrite module installed.',
- 'no'
+ 'no',
+ 90
);
CMYSQL