使用Magento旧版本数据库覆盖安装升级的过程中,往往新版不允许 数字或下划线开头的表前缀,如有异常则会出现以下提示
The table prefix should contain only letters (a-z),numbers (0-9) or underscores (_), the first character should be a letter.
出现问题但是我们又不能放弃就数据库中的数据资料,如何解决呢?
这边贴出一个修改检测规则的方法
修改文件
app/code/core/Mage/Install/Model/Installer/Db.php
修改默认
//check table prefix
if ($data['db_prefix'] != ”) {
if ( !preg_match(‘/^[a-z]+[a-z0-9_]*$/’, $data['db_prefix'])) {
Mage::throwException(
Mage::helper(‘install’)->__(‘The table prefix should contain only letters (a-z), ‘
. ‘numbers (0-9) or underscores (_), the first character should be a letter.’));
}
}
代码中检测规则为
if ( !preg_match(‘/^[a-z0-9_]+[a-z0-9_]*$/’, $data['db_prefix'])) {
使表前缀可以 以数字或下划线开头
保存后,清理缓存等文件 重新安装即可。
测试环境 Magento1.3.2.4 to Magento1.6.1.0
发表评论: