Revision: 50556
Author:   kim
Date:     2009-05-13 17:06:33 +0000 (Wed, 13 May 2009)

Log Message:
-----------
added dbname_prefix setting

Modified Paths:
--------------
    trunk/testing/installer/mediawiki_installer.py
    trunk/testing/installer/settings_handler.py

Modified: trunk/testing/installer/mediawiki_installer.py
===================================================================
--- trunk/testing/installer/mediawiki_installer.py      2009-05-13 16:47:46 UTC 
(rev 50555)
+++ trunk/testing/installer/mediawiki_installer.py      2009-05-13 17:06:33 UTC 
(rev 50556)
@@ -157,7 +157,7 @@
        """based on the name of the installer/instance, figure out what the 
name of the
        database is. Right now we just use the name of the installer as the 
name of the database,
        but that might not always work."""
-       return installer_name
+       return settings.dbname_prefix+installer_name
 
 
 #duplicate of get_installed() TODO: Refactor
@@ -281,7 +281,7 @@
        unique.write('<?php\n')
        unique.write('$wgSitename = "'+target+'";\n')
        unique.write('$wgScriptPath = "'+settings.base_scriptpath+target+'";\n')
-       unique.write('$wgDBname = "'+target+'";\n')
+       unique.write('$wgDBname = "'+dbname(target)+'";\n')
        unique.write('?>\n')
        
        unique.close()
@@ -317,25 +317,25 @@
        os.system(command)
 
 def dumpdb(target,outfile):
-       command=settings.mysqldump_command+" "+target+" > "+outfile
+       command=settings.mysqldump_command+" "+dbname(target)+" > "+outfile
        os.system(command)
 
 def do_sql(target, infile):
        """execute an sql file, using mysql"""
 
-       command="< "+infile+" "+settings.mysql_command+" "+target
+       command="< "+infile+" "+settings.mysql_command+" "+dbname(target)
        os.system(command)
 
 def createdb(target):
        """create a database using mysql"""
 
-       command="echo 'CREATE DATABASE "+target+";' | "+settings.mysql_command
+       command="echo 'CREATE DATABASE "+dbname(target)+";' | 
"+settings.mysql_command
        os.system(command)
 
 def dropdb(target):
        """drop a database using mysql"""
 
-       command="echo 'DROP DATABASE IF EXISTS "+target+";' | 
"+settings.mysql_command
+       command="echo 'DROP DATABASE IF EXISTS "+dbname(target)+";' | 
"+settings.mysql_command
        os.system(command)
 
 def delete(target):

Modified: trunk/testing/installer/settings_handler.py
===================================================================
--- trunk/testing/installer/settings_handler.py 2009-05-13 16:47:46 UTC (rev 
50555)
+++ trunk/testing/installer/settings_handler.py 2009-05-13 17:06:33 UTC (rev 
50556)
@@ -59,6 +59,16 @@
 mysql_user="root"
 mysql_pass=""
 
+
+#Prefix database names used by the installer with some unique string.
+# This is useful if multiple people on one machine are using the same
+# mysql instance, to prevent collisions. 
+#
+# Note that it might be a bad idea to change this is you still have 
+# old databases around, because the installer won't be able to see them.
+
+dbname_prefix=""
+
 # what mysql commands should be used. (Who us? Use horrible hacks?)
 
 userpart=""



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to