問題描述
我正在將 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.
為新版本創建一個新數據庫.(我在用SQLyog,因為它適用于大型數據庫的導入和導出).
Create a fresh database for the new version. (I am using SQLyog because it is good for big database importing and exporting).
在 www 或 htdocs 中提取并安裝新版本 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模板網!