Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b2c27f

Browse files
committed
One more update for #1200 (better implementation)
1 parent ac74184 commit 7b2c27f

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

plugins/dbms/mysql/takeover.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Takeover(GenericTakeover):
2828
def __init__(self):
2929
self.__basedir = None
3030
self.__datadir = None
31+
self.__plugindir = None
3132

3233
GenericTakeover.__init__(self)
3334

@@ -37,12 +38,12 @@ def udfSetRemotePath(self):
3738
banVer = kb.bannerFp["dbmsVersion"]
3839

3940
if banVer >= "5.0.67":
40-
logger.info("retrieving MySQL plugin directory absolute path")
41-
self.__basedir = unArrayizeValue(inject.getValue("SELECT @@plugin_dir"))
41+
if self.__plugindir is None:
42+
logger.info("retrieving MySQL plugin directory absolute path")
43+
self.__plugindir = unArrayizeValue(inject.getValue("SELECT @@plugin_dir"))
4244

43-
# On MySQL 5.1 >= 5.1.19 and on any version of MySQL 6.0
44-
if banVer >= "5.1.19":
45-
if self.__basedir is None:
45+
# On MySQL 5.1 >= 5.1.19 and on any version of MySQL 6.0
46+
if self.__plugindir is None and banVer >= "5.1.19":
4647
logger.info("retrieving MySQL base directory absolute path")
4748

4849
# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_basedir
@@ -53,14 +54,15 @@ def udfSetRemotePath(self):
5354
else:
5455
Backend.setOs(OS.LINUX)
5556

56-
# The DLL must be in C:\Program Files\MySQL\MySQL Server 5.1\lib\plugin
57-
if Backend.isOs(OS.WINDOWS):
58-
self.__basedir += "/lib/plugin"
59-
else:
60-
self.__basedir += "/lib/mysql/plugin"
57+
# The DLL must be in C:\Program Files\MySQL\MySQL Server 5.1\lib\plugin
58+
if Backend.isOs(OS.WINDOWS):
59+
self.__plugindir = "%s/lib/plugin" % self.__basedir
60+
else:
61+
self.__plugindir = "%s/lib/mysql/plugin" % self.__basedir
62+
63+
self.__plugindir = ntToPosixSlashes(normalizePath(self.__plugindir))
6164

62-
self.__basedir = ntToPosixSlashes(normalizePath(self.__basedir))
63-
self.udfRemoteFile = "%s/%s.%s" % (self.__basedir, self.udfSharedLibName, self.udfSharedLibExt)
65+
self.udfRemoteFile = "%s/%s.%s" % (self.__plugindir, self.udfSharedLibName, self.udfSharedLibExt)
6466

6567
# On MySQL 4.1 < 4.1.25 and on MySQL 4.1 >= 4.1.25 with NO plugin_dir set in my.ini configuration file
6668
# On MySQL 5.0 < 5.0.67 and on MySQL 5.0 >= 5.0.67 with NO plugin_dir set in my.ini configuration file

0 commit comments

Comments
 (0)