Commit 5d93ca43 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

2011-02-08 Kazuhiko

* remove upgrading MySQL charset part, that should be handled by buildout MySQL setup and reindexing with clear_catalog=1.
* remove handling zope version and python version, that should be handled by instance creation in buildout.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43177 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fe263d5b
No related merge requests found
......@@ -103,53 +103,6 @@ def ERP5Site_clearActivities(self):
os.remove(flag_fs_path)
return
def ERP5Site_upgradeMySQLCharset(self, upgrade=0):
"""
Update the catalog charset running a external command.
"""
from subprocess import Popen, PIPE
portal = self.getPortalObject()
message_list = []
database = portal.erp5_sql_connection.connection_string.split(' ')[0]
connection_string = ''
if '@' in database:
# This means the format database@hostname:port was used.
connection_string += ' -u root '
database_name , hostname = database.split("@")
if ":" in hostname:
new_hostname, port = hostname.split(":")
hostname = new_hostname
connection_string += ' --port=%s ' % port
connection_string += ' --host=%s ' % hostname
database = database_name
message = "ERP5Site_verifyMySQLCharset: Invalid configuration for: %s (%s)"
command = "echo \"show variables like '%%char%%'\" | mysql %s %s -Ns" % (connection_string, database)
stdout, stderr = Popen(command, stderr=PIPE, stdout=PIPE,
close_fds=True, shell=True).communicate()
for line in stdout.split("\n"):
if not line.strip(" ") == "" and \
not ('character_set_filesystem' in line and 'binary' in line) and \
not ('character_sets_dir' in line) and \
not ('utf8' in line and 'character_set_filesystem' not in line):
message_list.append(message % (database, line.replace("\t", " = ")))
if not upgrade:
return message_list
if len(message_list) > 0:
message_list = ["Upgrade was required to ERP5Site_verifyMySQLCharset."]
SQL = portal.ERP5Site_getUpgradeCatalogCharsetSQL(context=portal)
command = "echo '%s' | mysql %s " % (SQL, connection_string)
stdout, stderr = Popen(command, stderr=PIPE, stdout=PIPE,
close_fds=True, shell=True).communicate()
message_list.append("Upgrade Executed required to ERP5Site_upgradeMySQLCharset.")
message_list.append("ERP5Site_upgraadeMySQLCharset STDERR: %s" % stderr)
message_list.append("ERP5Site_upgradeMySQLCharset STDOUT: %s" % stdout)
return message_list
def ERP5Site_runVerificationScript(self, method_id):
""" Run a Python Script return the method. This should avoid raise error,
even one intergrity verification script raise error, and provide good
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>database = context.erp5_sql_connection.connection_string.split(\' \')[0]\n
database_name = database.split("@")[0]\n
\n
alter_table_str = "ALTER TABLE %s CHARSET=%s;"\n
alter_database_str = "ALTER DATABASE %s %s=%s;"\n
default_encode = \'utf8\'\n
\n
sql_list = []\n
\n
database_set_list = [\'CHARSET\']\n
\n
table_set_list = [\'catalog\',\'alarm\',\'catalog\',\'category\',\'delivery\',\'email\',\n
\'full_text\',\'inventory\',\'inventory_stock\',\'item\',\'measure\',\n
\'message\',\'message_queue\',\'movement\',\'portal_ids\',\'predicate\',\n
\'predicate_category\',\'record\',\'roles_and_users\',\'stock\',\n
\'subject\',\'translation\',\'versioning\']\n
\n
for data_set in database_set_list:\n
sql_list.append(alter_database_str % (database_name, data_set, default_encode))\n
\n
sql_list.append("USE %s;" % database_name)\n
\n
for table_set in table_set_list:\n
sql_list.append(alter_table_str % (table_set, default_encode))\n
\n
return \'\\n\'.join(sql_list)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getUpgradeCatalogCharsetSQL</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -285,7 +285,6 @@ FINALIZE_ALARM_SCRIPT = ( \'ERP5Site_upgradeGlobalPropertyList\',\n
\'ERP5Site_upgradeObjectClass\',\n
\'ERP5Site_upgradeSQLCatalogFilter\',\n
\'ERP5Site_upgradeAlarmToolConfiguration\',\n
#\'ERP5Site_upgradeMySQLCharset\',\n
)\n
\n
# \n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_upgradeMySQLCharset</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeMySQLCharset</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -69,8 +69,6 @@ message_list.extend(context.ERP5Site_upgradeWorkflowChain())\n
\n
message_list.extend(context.ERP5Site_upgradeSQLCatalog())\n
\n
message_list.extend(context.ERP5Site_upgradeMySQLCharset())\n
\n
if getattr(context, \'WizardTool_isPersonReferenceGloballyUnique\', None) is not None:\n
if len(context.PersonModule_getUserAccountList(\'occupied\')) == 0 and \\\n
getattr(portal.acl_users, \'nexedi_authentication\', None) is not None:\n
......
2011-02-08 Kazuhiko
* remove upgrading MySQL charset part, that should be handled by buildout MySQL setup and reindexing with clear_catalog=1.
* remove handling zope version and python version, that should be handled by instance creation in buildout.
2011-02-07 Kazuhiko
......
570
\ No newline at end of file
571
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment