196
197
do("/etc/init.d/apache2", "reload")
198
200
# Write the adminsettings
199
201
if change_type == 'modified':
200
# First time setup, we have to POST to the db and capture the LocalSettings.php
201
postargs = {'Sitename':'Ensemblized Wiki',
202
'EmergencyContact':'webmaster@localhost',
205
'SysopName':'WikiSysop',
206
'SysopPass':'change-me',
207
'SysopPass2':'change-me',
209
'Email':'email_enabled',
210
'Emailuser':'emailuser_enabled',
211
'Enotif':'enotif_disabled',
212
'Eauthent':'eauthent_enabled',
217
'DBpassword':password,
218
'DBpassword2':password,
202
connection = MySQLdb.connect(user=user, host=host, passwd=password, db=database)
203
cursor = connection.cursor()
221
install = urllib.urlopen('http://localhost/mediawiki/config/index.php', urllib.urlencode(postargs))
222
print "install URL returned ",install.getcode()
206
# Try to create the "mediawiki_ensemble_setup" table and if its already there, skip some things
207
cursor.execute("create table mediawiki_ensemble_setup (id int)")
223
209
except Exception as e:
224
print "WARNING: could not post to installer!"
226
# Sadly, we really have to discard this LocalSettings.php and re-build
227
# it using the template, so that joins can just generate it without
228
# trying to create the whole DB.
229
#do("mv","/var/lib/mediawiki/config/LocalSettings.php","/etc/mediawiki/LocalSettings.php.generated")
210
# If we can't create that table, it has likely already been initialized
211
print 'Could not create mediawiki_ensemble_setup: ' + str(e)
214
# First time setup, we have to POST to the db and capture the LocalSettings.php
215
postargs = {'Sitename':'Ensemblized Wiki',
216
'EmergencyContact':'webmaster@localhost',
219
'SysopName':'WikiSysop',
220
'SysopPass':'change-me',
221
'SysopPass2':'change-me',
223
'Email':'email_enabled',
224
'Emailuser':'emailuser_enabled',
225
'Enotif':'enotif_disabled',
226
'Eauthent':'eauthent_enabled',
231
'DBpassword':password,
232
'DBpassword2':password,
235
install = urllib.urlopen('http://localhost/mediawiki/config/index.php', urllib.urlencode(postargs))
236
print "install URL returned ",install.getcode()
237
except Exception as e:
238
print "WARNING: could not post to installer!"
240
# Sadly, we really have to discard this LocalSettings.php and re-build
241
# it using the template, so that joins can just generate it without
242
# trying to create the whole DB.
243
#do("mv","/var/lib/mediawiki/config/LocalSettings.php","/etc/mediawiki/LocalSettings.php.generated")
231
245
# Write the mediawiki config
232
246
fh = open('/etc/mediawiki/LocalSettings.php', "w")