use base 'Exporter';
#Where are data?
-our $directory = '/home/vorner/prog/pciids/';
+our $directory = '/home/vorner/prog/pciids/cf/';
our @EXPORT=qw($directory);
#Where are the modules?
+++ /dev/null
-USB
-This is USB ID.
-
-Device
-This is a device, not vendor.
--- /dev/null
+USB
+This is USB ID.
+
+Device
+This is a device, not vendor.
--- /dev/null
+db = pciids
+dbuser = pciids
+dbpasswd = 1234
+passwdsalt = 1234
+regmailsalt = 1234
+authsalt = 1234
+from_addr = vorner+pciids@ucw.cz
+sendmail = /home/vorner/bin/sendmail-apache
+logfile = /home/vorner/prog/pciids/pciids.log
+hostname = localhost
+jelnet = /home/vorner/bin/jelnet
+xmpp_passwd = 1234
+xmpp_name = none
--- /dev/null
+1 validate
+2 listUsers
+3 prune
--- /dev/null
+@users
+#Each row represents a registered user, with privileges or without
+id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,#Internal ID
+email VARCHAR(255) <<CHARSET>> UNIQUE NOT NULL,#His email for notifications
+xmpp TEXT <<CHARSET>>,#His XMPP address for notifications
+login VARCHAR(50) <<CHARSET>> UNIQUE,#Login name
+passwd VARCHAR(22) <<CHARSET>> NOT NULL,#Password hash
+lastlog TEXT <<CHARSET>>,#Where did he logged in last time?
+logtime TIMESTAMP,#When did he log in last time?
+mailgather INT UNSIGNED NOT NULL DEFAULT 240,#How long to gather mail notifications before sending?
+xmppgather INT UNSIGNED NOT NULL DEFAULT 15,#How long to gather xmpp notifications before sending?
+nextmail TIMESTAMP,#When do we send pending email notifications next time?
+nextxmpp TIMESTAMP#When do we send pending xmpp notifications?
+
+@locations
+#The locations are saved in a tree. ID of the location is created by
+#appending the local IDs of the nodes on the path together (children of
+#the root first), separated by '/'. Each node must know, how long are
+#the local IDs of its children.
+#
+#(Note that the local IDs can contain '/', since it can be recognized
+#by its length.)
+#
+#The first part is 2-letter specifier of information type. The first
+#version has these:
+#PC: PCI ID
+#PD: PCI Device Class
+#
+id VARCHAR(50) <<CHARSET>> NOT NULL UNIQUE PRIMARY KEY,#The name of the location, must be just node, no / at the end
+parent VARCHAR(50) <<CHARSET>>,#To allow selecting of all node's children
+mainhistory INT UNSIGNED,#Reference for the main history
+name TINYTEXT <<CHARSET>>,#Should match the one of main history, if any (if no main history, name can be set too)
+note TEXT <<CHARSET>>,#Should match the one of main history (if no main history, can be set too)
+CONSTRAINT parent_ref FOREIGN KEY (parent) REFERENCES locations(id) ON DELETE CASCADE
+
+@rights
+#Which privileges the users have?
+#It contains only the users with some extra privileges, not the normal ones
+userId INT UNSIGNED NOT NULL,#Who has the privilege
+rightId INT UNSIGNED NOT NULL,#What privilege
+CONSTRAINT right_user FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE,
+PRIMARY KEY (userId, rightId)
+
+@history
+#Contains the discussion and history of items
+id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
+owner INT UNSIGNED,#Who posted it?
+location VARCHAR(50) <<CHARSET>> NOT NULL,#Where it belongs
+discussion TEXT <<CHARSET>>,
+time TIMESTAMP NOT NULL DEFAULT NOW(),#When this was added
+nodename TINYTEXT <<CHARSET>>,#Modification of the location name
+nodenote TEXT <<CHARSET>>,#Modification of the location note
+seen BOOLEAN NOT NULL DEFAULT '0', #Did some admin see this, or is it still unseen?
+CONSTRAINT history_location FOREIGN KEY (location) REFERENCES locations(id) ON DELETE CASCADE,
+CONSTRAINT history_owner FOREIGN KEY (owner) REFERENCES users(id) ON DELETE SET NULL
+
+@notifications
+#Contains hooks for notifications
+user INT UNSIGNED NOT NULL,#Who wants it
+location VARCHAR(50) <<CHARSET>> NOT NULL,#Where
+recursive BOOLEAN NOT NULL DEFAULT '0',
+type SMALLINT NOT NULL,#When to send
+#0: History -- When a new discussion is posted
+#1: Description -- Name or note changed
+#2: MainHistory -- The main history changed
+#All contains the less common events
+notification SMALLINT NOT NULL,
+#0: mail only
+#1: xmpp only
+#2: both
+CONSTRAINT notification_location FOREIGN KEY (location) REFERENCES locations(id) ON DELETE CASCADE,
+CONSTRAINT notification_user FOREIGN KEY (user) REFERENCES users(id) ON DELETE CASCADE,
+PRIMARY KEY (user, location)
+
+@pending
+#Contains the pending notifications
+user INT UNSIGNED NOT NULL,
+history INT UNSIGNED NOT NULL,
+notification SMALLINT NOT NULL,
+#0: mail
+#1: xmpp
+#If a notification generates both, it splits to 2 of them
+reason SMALLINT NOT NULL,
+#0: New item
+#1: New history
+#2: Changed main article
+CONSTRAINT pending_history FOREIGN KEY (history) REFERENCES history(id) ON DELETE CASCADE,
+CONSTRAINT pending_user FOREIGN KEY (user) REFERENCES users(id) ON DELETE CASCADE
+++ /dev/null
-db = pciids
-dbuser = pciids
-dbpasswd = 1234
-passwdsalt = 1234
-regmailsalt = 1234
-authsalt = 1234
-from_addr = vorner+pciids@ucw.cz
-sendmail = /home/vorner/bin/sendmail-apache
-logfile = /home/vorner/prog/pciids/pciids.log
-hostname = localhost
-jelnet = /home/vorner/bin/jelnet
-xmpp_passwd = 1234
-xmpp_name = none
+++ /dev/null
-1 validate
-2 listUsers
-3 prune
}
use PciIds::Config;
use PciIds::Db;
+use PciIds::Startup;
use DBI;
my @lines;
}
my $dbh = connectDb();
-open TABLES, "tables" or die "Could not open table definitions\n";
+open TABLES, $directory."tables" or die "Could not open table definitions\n";
foreach( <TABLES> ) {
chomp;
if( /^\s*$/ ) {
+++ /dev/null
-@users
-#Each row represents a registered user, with privileges or without
-id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,#Internal ID
-email VARCHAR(255) <<CHARSET>> UNIQUE NOT NULL,#His email for notifications
-xmpp TEXT <<CHARSET>>,#His XMPP address for notifications
-login VARCHAR(50) <<CHARSET>> UNIQUE,#Login name
-passwd VARCHAR(22) <<CHARSET>> NOT NULL,#Password hash
-lastlog TEXT <<CHARSET>>,#Where did he logged in last time?
-logtime TIMESTAMP,#When did he log in last time?
-mailgather INT UNSIGNED NOT NULL DEFAULT 240,#How long to gather mail notifications before sending?
-xmppgather INT UNSIGNED NOT NULL DEFAULT 15,#How long to gather xmpp notifications before sending?
-nextmail TIMESTAMP,#When do we send pending email notifications next time?
-nextxmpp TIMESTAMP#When do we send pending xmpp notifications?
-
-@locations
-#The locations are saved in a tree. ID of the location is created by
-#appending the local IDs of the nodes on the path together (children of
-#the root first), separated by '/'. Each node must know, how long are
-#the local IDs of its children.
-#
-#(Note that the local IDs can contain '/', since it can be recognized
-#by its length.)
-#
-#The first part is 2-letter specifier of information type. The first
-#version has these:
-#PC: PCI ID
-#PD: PCI Device Class
-#
-id VARCHAR(50) <<CHARSET>> NOT NULL UNIQUE PRIMARY KEY,#The name of the location, must be just node, no / at the end
-parent VARCHAR(50) <<CHARSET>>,#To allow selecting of all node's children
-mainhistory INT UNSIGNED,#Reference for the main history
-name TINYTEXT <<CHARSET>>,#Should match the one of main history, if any (if no main history, name can be set too)
-note TEXT <<CHARSET>>,#Should match the one of main history (if no main history, can be set too)
-CONSTRAINT parent_ref FOREIGN KEY (parent) REFERENCES locations(id) ON DELETE CASCADE
-
-@rights
-#Which privileges the users have?
-#It contains only the users with some extra privileges, not the normal ones
-userId INT UNSIGNED NOT NULL,#Who has the privilege
-rightId INT UNSIGNED NOT NULL,#What privilege
-CONSTRAINT right_user FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE,
-PRIMARY KEY (userId, rightId)
-
-@history
-#Contains the discussion and history of items
-id INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
-owner INT UNSIGNED,#Who posted it?
-location VARCHAR(50) <<CHARSET>> NOT NULL,#Where it belongs
-discussion TEXT <<CHARSET>>,
-time TIMESTAMP NOT NULL DEFAULT NOW(),#When this was added
-nodename TINYTEXT <<CHARSET>>,#Modification of the location name
-nodenote TEXT <<CHARSET>>,#Modification of the location note
-seen BOOLEAN NOT NULL DEFAULT '0', #Did some admin see this, or is it still unseen?
-CONSTRAINT history_location FOREIGN KEY (location) REFERENCES locations(id) ON DELETE CASCADE,
-CONSTRAINT history_owner FOREIGN KEY (owner) REFERENCES users(id) ON DELETE SET NULL
-
-@notifications
-#Contains hooks for notifications
-user INT UNSIGNED NOT NULL,#Who wants it
-location VARCHAR(50) <<CHARSET>> NOT NULL,#Where
-recursive BOOLEAN NOT NULL DEFAULT '0',
-type SMALLINT NOT NULL,#When to send
-#0: History -- When a new discussion is posted
-#1: Description -- Name or note changed
-#2: MainHistory -- The main history changed
-#All contains the less common events
-notification SMALLINT NOT NULL,
-#0: mail only
-#1: xmpp only
-#2: both
-CONSTRAINT notification_location FOREIGN KEY (location) REFERENCES locations(id) ON DELETE CASCADE,
-CONSTRAINT notification_user FOREIGN KEY (user) REFERENCES users(id) ON DELETE CASCADE,
-PRIMARY KEY (user, location)
-
-@pending
-#Contains the pending notifications
-user INT UNSIGNED NOT NULL,
-history INT UNSIGNED NOT NULL,
-notification SMALLINT NOT NULL,
-#0: mail
-#1: xmpp
-#If a notification generates both, it splits to 2 of them
-reason SMALLINT NOT NULL,
-#0: New item
-#1: New history
-#2: Changed main article
-CONSTRAINT pending_history FOREIGN KEY (history) REFERENCES history(id) ON DELETE CASCADE,
-CONSTRAINT pending_user FOREIGN KEY (user) REFERENCES users(id) ON DELETE CASCADE