Moved to Git repo from PST server
This commit is contained in:
2
tools/.htaccess
Normal file
2
tools/.htaccess
Normal file
@@ -0,0 +1,2 @@
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
51
tools/dbinit.py
Executable file
51
tools/dbinit.py
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python
|
||||
'''
|
||||
Created on 15.09.2010
|
||||
|
||||
@author: Sergey Morozov
|
||||
'''
|
||||
|
||||
import MySQLdb, os, sys
|
||||
toolsdir = os.path.dirname(__file__)
|
||||
if toolsdir == '':
|
||||
toolsdir = '.'
|
||||
serverdir = toolsdir + os.sep + '..'
|
||||
sys.path.append(serverdir + os.sep + 'include')
|
||||
import functions
|
||||
config = functions.readConfig()
|
||||
|
||||
if __name__ == '__main__':
|
||||
db = MySQLdb.connect(
|
||||
host = config.mysql_server,
|
||||
user = config.mysql_user,
|
||||
passwd = config.mysql_password,
|
||||
db = config.mysql_database,
|
||||
port = int(config.mysql_port)
|
||||
)
|
||||
cursor = db.cursor()
|
||||
q = "CREATE TABLE IF NOT EXISTS `journal` ("\
|
||||
"`key` bigint(20) NOT NULL AUTO_INCREMENT,"\
|
||||
"`name` varchar(128) NOT NULL,"\
|
||||
"`position` varchar(128) NOT NULL,"\
|
||||
"`department` varchar(128) NOT NULL,"\
|
||||
"`date` date NOT NULL,"\
|
||||
"`start_time` time NOT NULL,"\
|
||||
"`end_time` time NOT NULL,"\
|
||||
"`description` text NOT NULL,"\
|
||||
"`chief` varchar(128) DEFAULT NULL,"\
|
||||
"`username` varchar(128) NOT NULL,"\
|
||||
"PRIMARY KEY (`key`)"\
|
||||
") ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"
|
||||
cursor.execute(q)
|
||||
db.commit()
|
||||
q = "CREATE TABLE IF NOT EXISTS `user_settings` ("\
|
||||
"`key` bigint(20) NOT NULL AUTO_INCREMENT,"\
|
||||
"`username` varchar(128) NOT NULL,"\
|
||||
"`setting` varchar(128) NOT NULL,"\
|
||||
"`value` text,"\
|
||||
"PRIMARY KEY (`key`)"\
|
||||
") ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"
|
||||
cursor.execute(q)
|
||||
db.commit()
|
||||
cursor.close()
|
||||
db.close()
|
||||
23
tools/shell.py
Executable file
23
tools/shell.py
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python -i
|
||||
'''
|
||||
Created on 16.12.2010
|
||||
|
||||
@author: morozov
|
||||
'''
|
||||
|
||||
if __name__ == '__main__':
|
||||
import os, sys, datetime
|
||||
toolsdir = os.path.dirname(__file__)
|
||||
if toolsdir == '':
|
||||
toolsdir = '.'
|
||||
serverdir = toolsdir + os.sep + '..'
|
||||
sys.path.append(serverdir + os.sep + 'include')
|
||||
import functions
|
||||
import database
|
||||
config = functions.readConfig()
|
||||
try:
|
||||
db = database.dbOperations(dbname = config.mysql_database, user = config.mysql_user, password = config.mysql_password, host = config.mysql_server, port = int(config.mysql_port))
|
||||
except:
|
||||
print('Error!')
|
||||
else:
|
||||
print('Created instance (named \'db\') of \'dbOperations\' class.')
|
||||
Reference in New Issue
Block a user