DrTrigon has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/104217


Change subject: bugfix; adopt DB config and access code to tool-labs
......................................................................

bugfix; adopt DB config and access code to tool-labs

Change-Id: Ia18ee4de27c5d844f89e4de4bf20d78214c2001d
---
M fabfile.py
M public_html/cgi-bin/ps_wikinew.py
M public_html/cgi-bin/sum_cat_disc.py
3 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/drtrigonbot 
refs/changes/17/104217/1

diff --git a/fabfile.py b/fabfile.py
index 9ad7693..9c1dca0 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -172,6 +172,7 @@
     local('ln -s pywikibot-drtrigonbot/.forward .forward')
     if LABS:    # labs-tools
         local('ln -s pywikibot-drtrigonbot/.description .description')
+        local('ln -s replica.my.cnf .my.cnf')   # DB config
     else:       # toolserver
         local('ln -s pywikibot-drtrigonbot/warnuserquota.py warnuserquota.py')
         local('ln -s pywikibot-drtrigonbot/.forward+subster .forward+subster')
diff --git a/public_html/cgi-bin/ps_wikinew.py 
b/public_html/cgi-bin/ps_wikinew.py
index a3bcc88..ab2eb86 100644
--- a/public_html/cgi-bin/ps_wikinew.py
+++ b/public_html/cgi-bin/ps_wikinew.py
@@ -118,3 +118,6 @@
 
 bot_path = {  'ts': ["../../pywikipedia/", "../../rewrite/"],
             'labs': ["../pywikibot-compat/", "../pywikibot-core/"], }
+
+db_conf  = {  'ts': ['u_drtrigon', "wiki-p.userdb.toolserver.org"],
+            'labs': ['u_drtrigon', "wiki.labsdb"], }
diff --git a/public_html/cgi-bin/sum_cat_disc.py 
b/public_html/cgi-bin/sum_cat_disc.py
index d36c7b1..94522d5 100755
--- a/public_html/cgi-bin/sum_cat_disc.py
+++ b/public_html/cgi-bin/sum_cat_disc.py
@@ -54,6 +54,7 @@
 import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 
compilant
 
 bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0])
+db_conf  = style.db_conf[style.host(os.environ)]
 
 
 # === pywikibot framework === === ===
@@ -418,7 +419,8 @@
 # Establich a connection
 #db = MySQLdb.connect(db='enwiki_p', host="enwiki-p.rrdb.toolserver.org", 
read_default_file="/home/drtrigon/.my.cnf")
 #db = MySQLdb.connect(db=wiki+'wiki_p', 
host=wiki+"wiki-p.rrdb.toolserver.org", 
read_default_file="/home/drtrigon/.my.cnf")
-db = MySQLdb.connect(db='u_drtrigon', 
host=wiki+"wiki-p.userdb.toolserver.org", 
read_default_file="/home/drtrigon/.my.cnf")
+#db = MySQLdb.connect(db='u_drtrigon', 
host=wiki+"wiki-p.userdb.toolserver.org", 
read_default_file="/home/drtrigon/.my.cnf")
+db = MySQLdb.connect(db=db_conf[0], host=wiki+db_conf[1], 
read_default_file=os.path.join(bot_path, "../.my.cnf"))
 # prepare a cursor object using cursor() method
 cursor = db.cursor()
 

-- 
To view, visit https://gerrit.wikimedia.org/r/104217
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia18ee4de27c5d844f89e4de4bf20d78214c2001d
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/drtrigonbot
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to