130
130
# Database name"""))
132
config_options.append(ConfigOption("plugins/forum/dbname", "ivle_forum",
133
"""Forum Database name:""",
135
# Forum Database name"""))
137
132
config_options.append(ConfigOption("database/username", "postgres",
138
133
"""Username for DB server login:""",
273
268
# the files that will be created/overwritten
274
269
conffile = os.path.join(cwd, "etc/ivle.conf")
275
phpBBconffile = os.path.join(cwd, "www/php/phpBB3/config.php")
277
271
# Get command-line arguments to avoid asking questions.
289
283
# Interactive mode. Prompt the user for all the values.
291
print """This tool will create the following files:
294
prompting you for details about your configuration. The file will be
295
overwritten if it already exists. It will *not* install or deploy IVLE.
285
print """This tool will create %s, prompting you for details about
286
your configuration. The file will be overwritten if it already exists.
297
288
Please hit Ctrl+C now if you do not wish to do this.
298
""" % (conffile, phpBBconffile)
300
291
# Get information from the administrator
301
292
# If EOF is encountered at any time during the questioning, just exit
343
334
conf['usrmgt']['magic'] = hashlib.md5(uuid.uuid4().bytes).hexdigest()
345
# Generate the forum secret
346
forum_secret = hashlib.md5(uuid.uuid4().bytes).hexdigest()
348
337
# Write ./etc/ivle.conf (even if we loaded from a different filename)
349
338
conf.filename = conffile
351
340
conf.initial_comment = ["# IVLE Configuration File"]
353
# Add the forum secret to the config file (regenerated each config)
354
config_options.append(ConfigOption('plugins/forum/secret', None, '', ''))
355
conf['plugins']['forum']['secret'] = forum_secret
343
conf['plugins']['forum']['secret']
345
# Generate the forum secret.
346
forum_secret = hashlib.md5(uuid.uuid4().bytes).hexdigest()
347
conf['plugins']['forum']['secret'] = forum_secret
359
351
print "Successfully wrote %s" % conffile
361
# Write www/php/phpBB3/config.php
363
conf_php = open(phpBBconffile, "w")
366
if conf['database']['host'] == 'localhost':
367
forumdb_host = '127.0.0.1'
369
forumdb_host = conf['database']['host']
371
conf_php.write( """<?php
372
// phpBB 3.0.x auto-generated configuration file
373
// Do not change anything in this file!
375
$dbhost = '""" + forumdb_host + """';
376
$dbport = '""" + str(conf['database']['port']) + """';
377
$dbname = '""" + conf['plugins']['forum']['dbname'] + """';
378
$dbuser = '""" + conf['database']['username'] + """';
379
$dbpasswd = '""" + conf['database']['password'] + """';
381
$table_prefix = 'phpbb_';
383
$load_extensions = '';
384
@define('PHPBB_INSTALLED', true);
385
// @define('DEBUG', true);
386
//@define('DEBUG_EXTRA', true);
388
$forum_secret = '""" + forum_secret +"""';
393
print "Successfully wrote %s" % phpBBconffile
396
print "You may modify the configuration at any time by editing"
353
print "You may modify the configuration at any time by editing " + conffile