Magento 升级需要很长时间并且永远不会完成

时间:2022-12-02
本文介绍了Magento 升级需要很长时间并且永远不会完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 magento 从 1.4.0.1 升级到 1.7.0.2.最初有一些错误;修复这些问题后,现在升级运行了 5 个小时,但从未完成.没有错误显示.知道为什么会这样吗?

I am upgrading magento from 1.4.0.1 to 1.7.0.2. Initially there were some errors; after fixing those, now the upgrade is running for 5 hours and never completes. No error is displaying. Any idea why it is happening?

推荐答案

I On the query logging 通过更改 libVarienDbAdapterPdoMysql.php 文件中的以下几行

I On the query logging by changing the following lines in libVarienDbAdapterPdoMysql.php file

protected $_debug               = true;
protected $_logAllQueries       = true;
protected $_debugFile           = 'var/debug/pdo_mysql.log';

然后通过分析 pdo_myql.log 文件我开始知道查询正在执行时出错,因此 magento 安装程序一次又一次地运行它.

Then by analyzed the pdo_myql.log file I came to know that a query is executing with error and thus the magento installer run it again and again.

错误是.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ''11199-1' for key 'UNQ_INCREMENT_ID'

所以我删除了数据库表和 pdo_mysql.log 中的条目,现在其他查询正在显示并且升级完成.

So I deleted the entry in the database table and in pdo_mysql.log now other queries are displaying and the up-gradation is complete.

在 magento 升级上工作了很多天,我总结了将 magento 从 1.4.0.1 成功升级到 1.7.0.2 的步骤.其他项目显示的这些错误会有所不同,因为每个项目都有不同的数据.

Working many days on magento upgrade, I am summarizing the steps to successfully upgrading magento from 1.4.0.1 to 1.7.0.2. These errors displayed will be different for other projects because every project have different data.

  1. 为新版本创建一个新数据库.(我在用SQLyog,因为它适用于大型数据库的导入和导出).

  1. Create a fresh database for the new version. (I am using SQLyog because it is good for big database importing and exporting).

wwwhtdocs 中提取并安装新版本 1.7.0.1.我的项目名称是 ma​​gento171.

Extract and Install fresh version 1.7.0.1 in www or htdocs. My project name is magento171.

创建新数据库,因为我们将在修复步骤中需要新数据库.

Create new database because we will need the fresh db in repair step.

旧数据库数据导入新数据库.

在新安装的 magento 版本中更改 etc/local.xml 中的新数据库名称.

Change the new database name in etc/local.xml in new installed version of magento.

etc/local.xml中找到并将SET NAMES utf8更改为SET NAMES utf8;SET FOREIGN_KEY_CHECKS=0;SET UNIQUE_CHECKS=0; .

In etc/local.xml find and change SET NAMES utf8 to SET NAMES utf8; SET FOREIGN_KEY_CHECKS=0; SET UNIQUE_CHECKS=0; .

在新版本的 magento 中复制旧项目文件.我有主题空白文件夹.如果默认有模板文件,则复制默认值文件夹.

Copy old project file in new version of magento. I have the theme in blank folder. Copy default if you have template files in default folder.

• 应用设计前端默认空白

• appdesignfrontenddefaultlank

• 应用代码本地

• 皮肤前端默认/空白

• skinfrontenddefault/blank

• appetcmodules(复制新版本中没有的文件).

• appetcmodules (copy the files which are not in the new version).

在 MySql 查询日志中,通过更改以下几行libVarienDbAdapterPdoMysql.php

On the MySql queries logging by changing the following lines in libVarienDbAdapterPdo Mysql.php

 protected $_debug               = true;
 protected $_logAllQueries       = true;
 protected $_debugFile           = 'var/debug/pdo_mysql.log';

  • 搜索和更改创建表创建表如果不存在在代码/核心/法师/.

  • Search and change CREATE TABLE to CREATE TABLE IF NOT EXISTS In code/core/mage/.

    更改表 core_config_data 中的以下条目(使用您的项目文件夹名称).

    Change the following entries in the table core_config_data (use your project folder name).

      • web/unsecure/base_url | http://localhost/magento171/
      • web/secure/base_url   | http://localhost/magento171/
    

  • /errors/local.xml.sample 重命名为 /errors/local.xml 以启用 error_reporting .

  • Rename /errors/local.xml.sample to /errors/local.xml to enable error_reporting .

    通过删除varcache中的所有数据来清除magento缓存.

    Clear the magento cache by delete all the data in varcache.

    转到浏览器并输入您的项目路径.http://localhost/magento171/ 并留意浏览器和 var/debug/pdo_mysql.log 文件.

    Go to browser and type the your project path. http://localhost/magento171/ and keep eyes on the browser and on the var/debug/pdo_mysql.log file.

    我遇到的第一个错误是:文件错误:"D:xampphtdocsmagento171appcodecoreMageSalessqlsales_setupmysql4-upgrade-1.3.99-1.4.0.0.php"

    The first error occurred to me is: Error in file: "D:xampphtdocsmagento171appcodecoreMageSalessqlsales_setupmysql4-upgrade-1.3.99-1.4.0.0.php"

    • SQLSTATE[23000]:违反完整性约束:1062 键PRIMARY"的重复条目7"

    修复:我从 pdo_mysql.log 文件中发现问题出在 sales_flat_order 表中,这意味着存在许多主键的重复条目,因此我截断了所有销售表.这实际上是我旧数据库中的错误.在新版本中 increment_id 是唯一的.我们不能跳过主键检查,所以我截断了所有与销售相关的表.如果您有同样的问题,则截断与该功能相关的所有表,例如如果在客户中重复则截断所有客户表,或者如果在目录中则截断目录表.但是请记住截断应该在发生错误的时候进行,因为如果在安装开始之前截断安装程序将不会读取现有数据,最终您会丢失一些记录,例如丢失一些订单或发票.

    Fix: I found from pdo_mysql.log file that the issue is in the sales_flat_order table, which means many duplicate entries for primary key are there so I truncate all the sales tables. This is actually the error in my old DB. In new version increment_id is UNIQUE. We can't skip primary key checks, so I truncated all the tables related to sales. If you have same issue then truncate all tables related to that feature like if duplicate in customer then truncate all customer table or if in catalog then truncate catalog tables. But remember truncate should be done at the time when the error is occured because if truncated before the installation begins the installer will not read the existing data and finally you will miss some records like missing some orders or invoices.

    SET FOREIGN_KEY_CHECKS = 0;
    TRUNCATE `sales_flat_creditmemo`;
    TRUNCATE `sales_flat_creditmemo_comment`;
    TRUNCATE `sales_flat_creditmemo_grid`;
    TRUNCATE `sales_flat_creditmemo_item`;
    TRUNCATE `sales_flat_invoice`;
    TRUNCATE `sales_flat_invoice_comment`;
    TRUNCATE `sales_flat_invoice_grid`;
    TRUNCATE `sales_flat_invoice_item`;
    TRUNCATE `sales_flat_order`;
    TRUNCATE `sales_flat_order_address`;
    TRUNCATE `sales_flat_order_grid`;
    TRUNCATE `sales_flat_order_item`;
    TRUNCATE `sales_flat_order_payment`;
    TRUNCATE `sales_flat_order_status_history`;
    TRUNCATE `sales_flat_quote`;
    TRUNCATE `sales_flat_quote_address`;
    TRUNCATE `sales_flat_quote_address_item`;
    TRUNCATE `sales_flat_quote_item`;
    TRUNCATE `sales_flat_quote_item_option`;
    TRUNCATE `sales_flat_quote_payment`;
    TRUNCATE `sales_flat_quote_shipping_rate`;
    TRUNCATE `sales_flat_shipment`;
    TRUNCATE `sales_flat_shipment_comment`;
    TRUNCATE `sales_flat_shipment_grid`;
    TRUNCATE `sales_flat_shipment_item`;
    TRUNCATE `sales_flat_shipment_track`;
    SET FOREIGN_KEY_CHECKS = 1;
    

  • 安装时间太长,所以我检查了 pdo_mysql.log 文件,并且一次又一次地显示以下错误.显示错误:SQLSTATE[23000]:违反完整性约束:1062 重复条目 ''11199-1' 键'UNQ_INCREMENT_ID''使固定:所以我删除了表中的第一个条目.

  • The installation takes too long, so I inspect the pdo_mysql.log file and the following error is displaying again and again. Error displayed: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ''11199-1' for key 'UNQ_INCREMENT_ID'' Fix: So I delete the first entry in the table.

    数据库修复步骤:需要使用ma​​gento-db-repair-tool-1.1(http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool).报告最后将显示所有修复.

    Database Rapair Step: It is necessary to Repair the new database with the fresh database using magento-db-repair-tool-1.1 (http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool). It the end the report will show all the fixes.

    现在您可以简单地将网站转移到实时服务器.

    Now you can simply shift the website to the live server.

    这篇关于Magento 升级需要很长时间并且永远不会完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

  • 上一篇:Magento - 检索具有特定属性值的产品 下一篇:为什么 Magento 这么慢?

    相关文章

    最新文章