From: Michal Vaner Date: Mon, 8 Sep 2008 16:30:12 +0000 (+0200) Subject: Move static config files into cf X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=fdb81fb612652a1a45efb740c2afde37f3b252aa;p=pciids.git Move static config files into cf --- diff --git a/PciIds/Startup.pm b/PciIds/Startup.pm index ee7d9db..478b4ba 100644 --- a/PciIds/Startup.pm +++ b/PciIds/Startup.pm @@ -22,7 +22,7 @@ use warnings; 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? diff --git a/answers b/answers deleted file mode 100644 index e1f3acc..0000000 --- a/answers +++ /dev/null @@ -1,5 +0,0 @@ -USB -This is USB ID. - -Device -This is a device, not vendor. diff --git a/cf/answers b/cf/answers new file mode 100644 index 0000000..e1f3acc --- /dev/null +++ b/cf/answers @@ -0,0 +1,5 @@ +USB +This is USB ID. + +Device +This is a device, not vendor. diff --git a/cf/config b/cf/config new file mode 100644 index 0000000..0b10317 --- /dev/null +++ b/cf/config @@ -0,0 +1,13 @@ +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 diff --git a/cf/rights b/cf/rights new file mode 100644 index 0000000..a1cd64a --- /dev/null +++ b/cf/rights @@ -0,0 +1,3 @@ +1 validate +2 listUsers +3 prune diff --git a/cf/tables b/cf/tables new file mode 100644 index 0000000..680780a --- /dev/null +++ b/cf/tables @@ -0,0 +1,88 @@ +@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) <> UNIQUE NOT NULL,#His email for notifications +xmpp TEXT <>,#His XMPP address for notifications +login VARCHAR(50) <> UNIQUE,#Login name +passwd VARCHAR(22) <> NOT NULL,#Password hash +lastlog TEXT <>,#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) <> NOT NULL UNIQUE PRIMARY KEY,#The name of the location, must be just node, no / at the end +parent VARCHAR(50) <>,#To allow selecting of all node's children +mainhistory INT UNSIGNED,#Reference for the main history +name TINYTEXT <>,#Should match the one of main history, if any (if no main history, name can be set too) +note TEXT <>,#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) <> NOT NULL,#Where it belongs +discussion TEXT <>, +time TIMESTAMP NOT NULL DEFAULT NOW(),#When this was added +nodename TINYTEXT <>,#Modification of the location name +nodenote TEXT <>,#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) <> 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 diff --git a/config b/config deleted file mode 100644 index 0b10317..0000000 --- a/config +++ /dev/null @@ -1,13 +0,0 @@ -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 diff --git a/rights b/rights deleted file mode 100644 index a1cd64a..0000000 --- a/rights +++ /dev/null @@ -1,3 +0,0 @@ -1 validate -2 listUsers -3 prune diff --git a/scripts/initdb.pl b/scripts/initdb.pl index 730bfd3..45589f6 100755 --- a/scripts/initdb.pl +++ b/scripts/initdb.pl @@ -25,6 +25,7 @@ BEGIN { } use PciIds::Config; use PciIds::Db; +use PciIds::Startup; use DBI; my @lines; @@ -46,7 +47,7 @@ sub createTable( $ ) { } 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( ) { chomp; if( /^\s*$/ ) { diff --git a/tables b/tables deleted file mode 100644 index 680780a..0000000 --- a/tables +++ /dev/null @@ -1,88 +0,0 @@ -@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) <> UNIQUE NOT NULL,#His email for notifications -xmpp TEXT <>,#His XMPP address for notifications -login VARCHAR(50) <> UNIQUE,#Login name -passwd VARCHAR(22) <> NOT NULL,#Password hash -lastlog TEXT <>,#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) <> NOT NULL UNIQUE PRIMARY KEY,#The name of the location, must be just node, no / at the end -parent VARCHAR(50) <>,#To allow selecting of all node's children -mainhistory INT UNSIGNED,#Reference for the main history -name TINYTEXT <>,#Should match the one of main history, if any (if no main history, name can be set too) -note TEXT <>,#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) <> NOT NULL,#Where it belongs -discussion TEXT <>, -time TIMESTAMP NOT NULL DEFAULT NOW(),#When this was added -nodename TINYTEXT <>,#Modification of the location name -nodenote TEXT <>,#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) <> 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