]> mj.ucw.cz Git - pciids.git/commitdiff
Move static config files into cf
authorMichal Vaner <vorner@ucw.cz>
Mon, 8 Sep 2008 16:30:12 +0000 (18:30 +0200)
committerMichal Vaner <vorner@ucw.cz>
Mon, 8 Sep 2008 16:30:12 +0000 (18:30 +0200)
PciIds/Startup.pm
answers [deleted file]
cf/answers [new file with mode: 0644]
cf/config [new file with mode: 0644]
cf/rights [new file with mode: 0644]
cf/tables [new file with mode: 0644]
config [deleted file]
rights [deleted file]
scripts/initdb.pl
tables [deleted file]

index ee7d9dba96d1645325dbf202f83bea57e1462646..478b4ba0469e0735b645d18dcedb83f0f66b41c0 100644 (file)
@@ -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 (file)
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 (file)
index 0000000..e1f3acc
--- /dev/null
@@ -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 (file)
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 (file)
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 (file)
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) <<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
diff --git a/config b/config
deleted file mode 100644 (file)
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 (file)
index a1cd64a..0000000
--- a/rights
+++ /dev/null
@@ -1,3 +0,0 @@
-1 validate
-2 listUsers
-3 prune
index 730bfd3f0603952effd275ded0603334b183ec14..45589f6c3a6377d9953eacc72d504394a31b36c7 100755 (executable)
@@ -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( <TABLES> ) {
        chomp;
        if( /^\s*$/ ) {
diff --git a/tables b/tables
deleted file mode 100644 (file)
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) <<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