久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

進行 Magento 更新的最佳實踐?

Best practice for conducting a Magento update?(進行 Magento 更新的最佳實踐?)
本文介紹了進行 Magento 更新的最佳實踐?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

進行 Magento 更新(維護不善的 Magento 安裝)的最佳做法是什么.

What is the best practice for making a Magento update (of a badly maintained Magento installation).

我想到了以下幾點:

  • 查看 app/code/local 中的完整覆蓋模塊 - 將文件與舊版本進行比較,并將它們轉(zhuǎn)發(fā)到新的 Magento 版本
  • 比較模板
  • 比較布局 XML 文件(如果它們被直接復(fù)制到自定義主題文件夾并且沒有使用僅包含真實更新的單個 layout.xml)
  • 比較重寫類的方法與原始類的方法

主要問題是:在舊的、維護不善的 Magento 安裝中比較文件時,您永遠不知道復(fù)制的原始文件具有哪個版本.有時我試圖通過查看文件注釋中的 Magento 版權(quán)來識別舊版本.

The main problem is: When diffing files in old, badly maintained Magento installations, you never know, which version the original file that was copied had. Sometimes I tried to identify the old version by having a look on Magento's copyright in the file comment.

為了避免更新過程中的麻煩,我們通常會執(zhí)行以下操作:

To avoid hassle during update we usually do the following:

  • 避免重寫,改用事件
  • 如果需要重寫,盡量不要復(fù)制代碼,而是調(diào)用 parent::method() 以在被覆蓋的類中只保留必要的功能
  • 如果需要復(fù)制代碼,請使用標記注釋,例如 [Mycompany BEGIN] ... [Mycompany END]
  • 不要復(fù)制整個布局文件,而是使用一個只進行更新的 layout.xml.

但是如果沒有采取這些預(yù)防措施,如何進行更新?

But how to do an update if those precautions where not taken?

推薦答案

正如其他人所指出的,這里的關(guān)鍵是讓它與干凈安裝相媲美,所以這里是我將在版本控制的幫助下做的事情.

As others have noted the key here is to make it comparable against clean installation so here's what I would do with the help of version control.

  1. 讓自己獲得當前使用的 Magento 的干凈版本,并且不要忘記使其具有可比性.或者使用現(xiàn)有的 magento git 鏡像(參見更多 http://blog.speedupmate.com/post/4063307705/magento-git-mirror )

根據(jù) 1. 在這里設(shè)置一個主存儲庫并準備好

set up a master repo based on 1. here and have it at hand

在評論中提問:您的最終目標是擁有一個干凈的核心,其中包含 magento 安裝文件中存在的 git 中的所有文件.這是必需的,因此您可以將所有內(nèi)容與全新安裝進行比較.管理核心更改,核心文件樹(現(xiàn)有、不存在、添加的文件).您可以使用 .gitignore 處理您的異常(不包括媒體、緩存、具有服務(wù)器特定范圍 local.xml .htaccess 的所有字段).我發(fā)現(xiàn)將 Magento 核心文件移出到不同的(非公共)目錄很容易(如此處所述 http://blog.speedupmate.com/post/9992573819/poor-mans-multisite-setup-for-magento ),這會給我一個代碼狀態(tài),其中 .htaccess 從不升級沖突.我也從未在版本控制、緩存和 magento 生成的所有臨時文件中包含媒體.這將保證您的升級路徑清晰,因為您可以在升級時間內(nèi)禁用所有功能.稍后比較代碼將為您提供需要概覽的范圍,并且您可以估算比較更改的部分并進行升級所需的時間.

Asked in comments: Your ultimate goal is to have a clean core with all files in git that are present in magento installation files. That is needed so you can compare everything against the clean installation. Managing core changes, core filetree (existing, non-existing, added files). You can handle your exceptions with .gitignore (excluding media , cache, all fiels with server specific scope local.xml .htaccess). I find it easy to move out Magento core files to different (non public) directory (as explained here http://blog.speedupmate.com/post/9992573819/poor-mans-multisite-setup-for-magento ) and that will give me a code state where .htaccess never conflicts on upgrade. I also never include media in version control , cache and all temporary files that magento generates. This will guarantee you clear path on upgrades as you can disable all for the upgrade time. Comparing the code later will give you scope of things you need to overview and you can estimate how long it will take you to compare the changed parts and go live with upgrade.

現(xiàn)在使用您現(xiàn)有的站點和 git config(使其具有可比性)在您的代碼庫上執(zhí)行 git init 并將所有內(nèi)容添加到 git 那里,這將檢查您的 git 配置并使每個文件具有可比性(相同的換行符、空格等),然后將文件權(quán)限修復(fù)為相同.之后,您可以從您的站點中刪除 .git 文件夾,因為您只使用 git 在那里制作可比較的文件.

now with your existing site and git config in place (to make it comparable) do a git init on your codebase and add everything to git there , this will go over your git config and make every file comparable (same newlines, whitespaces etc) then fix file permissions to be the same. After that you can remove the .git folder from your site as you only used git to make files comparable there.

在評論中提問:這里的重點是讓 git 為您工作,例如將所有行結(jié)尾轉(zhuǎn)換為 unix 樣式并忽略空格,理論上您也可以忽略權(quán)限,但這沒有用(這里的格式有點不對,所以 代表命令之間換行

Asked in comments: The point here is to have git do work for you like converting all line endings to unix style and ignore whitespaces, you can ignore permissions too in theory but that's not useful (formatting is bit off here so represents a line break between commands

git config core.autocrlf 輸入 git 配置 core.eol lf git config apply.whitespace nowarn

現(xiàn)在如果你執(zhí)行 git init并添加這些配置并將所有內(nèi)容添加到 git 然后在提交階段 git 將替換您所有的 Windows 行結(jié)尾和所有廢話,以統(tǒng)一和可比較的樣式.請注意,zend 編碼標準建議使用 unix 樣式的行結(jié)尾,但是您也會看到 Zend 庫不遵循其自身標準的文件.這里的關(guān)鍵點是您需要您的文件具有可比性,以最大限度地減少您必須做的差異負載.在 git 為您格式化所有錯誤的安裝文件后,您將刪除 .git 文件夾.Git 僅用于自動化此步驟中的使事物具有可比性的過程",沒有其他作用

Now if you do git init and add those configs and add everything to git then during committing stage git will replace all your windows line endings and all that crap to unified and comparable style. Note that zend coding standard suggest unix style line endings however you will also see the files where Zend library does not follow it's own standards. Key point here is that you need your files to be comparable to minimize the diff load you have to do. You will remove the .git folder after git has formatted all your bad installation files for you. Git is only used to automate the "make things comparable process" in this step and nothing else

根據(jù) 1. 中的主存儲庫簽出您的測試存儲庫,并使用您當前所在的版本簽出一個分支并將其命名為testsomething"或您需要的任何名稱

checkout your test repository based from your master repo in 1. and checkout a branch with the version you are currently on and name it "testsomething" or whatever you need

刪除該結(jié)帳文件夾中的所有內(nèi)容并僅保留 .git 以使其為空,但版本控制仍然存在.它將處于所有內(nèi)容都已刪除的狀態(tài),這在這里很重要,因為您將知道您可能在不良站點上刪除了哪些文件.

delete everything from that checkout folder and leave only .git in place so it is empty but version control still exists there. It will be in state like everything is deleted and this is important here cause based on that you will know what files you might have deleted on your bad site.

在評論中提問:我通常在 git config 中添加忽略空格(本地或全局范圍可用)并讓 git 為我處理.在團隊中工作時,我們總是同意基于 Zend 的標準:4 個空格用于制表符、unix 樣式行結(jié)尾和 3 中提到的 git 配置變量.如果涉及構(gòu)建腳本,我們會使用提交鉤子進行代碼格式化和驗證.

Asked in comments: I usually add whitespace ignoring to git config (local or global scope is available) and let git handle that for me. When working in teams we always agree on based Zend standards: 4 spaces for tabs, unix style line endings and git config variables mentioned at 3. and if build scripts are involved we do code formatting and validation with commit hooks.

將所有文件移動到您的空目錄中(請注意,您已將 .git 目錄從現(xiàn)有站點中刪除,使其具有可比性)從您的 fcked magento 安裝(它們現(xiàn)在可以比較)和運行 git status >更改.txt .該文件現(xiàn)在列出了您擁有的所有差異、您擁有的任何新文件、任何已刪除、重命名的文件,以及您在安裝"中與當前使用的干凈 Magento 代碼相對應(yīng)的文件.

move in all files to your empty dir (note that you have removed the .git dir from your existing site after making it comparable) from your fcked up magento installation (they are comparable now) and run a git status > changes.txt . This file now lists every difference you have , any new file you have, any deleted, renamed, etc file you have on your "fcked up installation" against the clean Magento code that you are currently on.

基于評論的解釋:我通常做git status --porcelain

Explaining based on comments: I usually do git status --porcelain

有一個 .gitignore 文件可以幫助您丟棄 local.xml var/* 或不需要版本控制的每個文件/目錄,以及 .DS_Store、.Thumbs.db 和您創(chuàng)建的 ide來自 git 的項目文件.您不需要版本控制上的所有媒體和緩存文件以及每個服務(wù)器中不同的文件.

have a .gitignore file in place to help you discard local.xml var/* or every file/dir that you don't need to version control and also .DS_Store, .Thumbs.db and your ide created project files from git. YOu don't need all Media and cached files and files that are different in each server on your version control.

從那里您應(yīng)該仔細瀏覽該列表,并根據(jù)該列表:

From there you should overview that list carefully and based on that list you should:

  • 將每個核心更改移動到 app/code/local/并將更改的文件檢出到其原始狀態(tài)(保留復(fù)制的文件并使用 git checkout filename 丟棄核心中的更改)
  • 將每個更改的核心模板和布局文件移動到您自己的主題文件夾并將更改的文件簽出到其原始狀態(tài)
  • 恢復(fù)或遷移 .htaccess 更改或決定是否需要保留或丟棄

現(xiàn)在你的狀態(tài)仍然很差,但你現(xiàn)在:

Now you still are in bad shape but you are now:

  • 基于干凈的核心
  • 基于單獨分支中的版本化主樹

現(xiàn)在您可以受益于版本控制、可比較和基于主分支的單獨分支,其中包含可合并的 Magento 版本.因此,讓我們嘗試升級,這是 100% 成功的關(guān)鍵點.

Now you can benefit on being version controlled, comparable and in separate branch based on your master branch that has mergable versions of Magento in it. So lets try to upgrade, here's the key points of 100% success on doing this.

  1. 第一步是禁用您現(xiàn)在已分離到 app/code/local/Mage/和分離主題的所有廢話".如果您的核心是明確的并且可以禁用主題,那么您就沒有干擾升級過程的自定義代碼.所以繼續(xù)禁用:

  1. first step would be disable all the "crap" that you have now separated to app/code/local/Mage/ and to separate theme. If your core is clear and themes can be disabled you have no custom code interfering with upgrade process. So go ahead disable:

  • 通過將所有本地擴展和自定義社區(qū)擴展移出 app/etc/modules/到臨時文件夾,讓它成為 app/etc/inactive/
  • 禁用自定義主題并打開基本/默認/
  • 這是您處于可比狀態(tài)的好處.你知道有什么不同,你可以禁用它并根據(jù)它進行診斷

現(xiàn)在,如果您的 repo 中的主樹中的所有主要版本都單獨標記或分支,那么提高版本只是一個命令:git merge "magento-vhateverthenextversionis"

now if you have all major versions in the master tree in your repo tagged or branched separately then getting the version higher is just a command away: git merge "magento-vhateverthenextversionis"

  • 再次執(zhí)行此操作后,git status > changes.txt"將為您提供版本之間所有更改文件的列表
  • 在瀏覽器上執(zhí)行站點將執(zhí)行升級,并且由于您使用的是默認主題且未激活任何自定義,因此它會像魅力一樣執(zhí)行
  • 按版本重復(fù)升級版本并通過在測試分支中添加標簽來保存代碼狀態(tài),或者根據(jù)現(xiàn)有測試分支為每個版本創(chuàng)建一個新分支,這樣您就為中間升級的每個 magento 版本保存了干凈的狀態(tài)
  • 這里還有一個額外的好處是,如果您使用版本控制來執(zhí)行此操作,您還將擺脫新版本丟棄的文件,您可以輕松刪除它們

如果您已經(jīng)將 2. 迭代到您想要的 magento 版本到最新,那么是時候吃掉您繼承的s*it"并執(zhí)行以下操作:

if you have iterated the 2. to your desired magento version to latest then it is time to eat the "s*it" that you have inherited and do following:

  • 分析您擁有的所有擴展程序,看看它們是否可以升級,如果您可以升級并打開,看看它們是否適用于默認主題
  • 將 app/code/local/Mage 中的每個內(nèi)核重寫與來自 app/code/core/Mage 的新形式的原始版本進行比較.您可以使用差異工具,例如 winmerge.org 或更改(無論您喜歡哪種操作系統(tǒng)和工具)或更改整個文件夾
  • 同樣適用于您的模板和覆蓋的模板或布局.與原始模板進行比較并將您的更改合并到新的基本模板并擺脫舊的 DOM
  • 一一開啟主題更改和擴展并調(diào)試

如果你到了這一點,那么你已經(jīng)完成了一大堆工作,這取決于安裝有多混亂,它可能需要幾天時間.但是,嘿現(xiàn)在你有一個干凈的 magento 核心,它是版本控制的,單獨的覆蓋合并和概覽,以及可以禁用的單獨主題中的所有內(nèi)容.

if you get to this point then you have done a shitload of work , dependant how messed up the installation is it can take days. But hey now you have a clean magento core that is version controlled, separated overwrites that are merged and overviewed , and all stuff in separate theme that can be disabled.

有趣的部分是,如果 magento 的下一次升級可用,您可以吹口哨并將其添加為與您的主樹相當并合并更改,了解更改的內(nèi)容并對要概述和測試的內(nèi)容有明確的范圍.

fun part is that if next upgrade of magento is available you can whistle and add it as comparable to your master tree and merge down the changes, know what is changed and have a clear scope on what to overview and test.

這篇關(guān)于進行 Magento 更新的最佳實踐?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設(shè)置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 成人精品视频 | 人妖无码| 精品久久久久一区二区国产 | 精品视频一区二区三区 | 性福视频在线观看 | 日本午夜在线视频 | 国产日韩欧美二区 | av手机在线播放 | 毛片黄片| 国产激情一区二区三区 | 日韩中文视频 | 午夜精品 | 亚洲国产精品va在线看黑人 | 久久久久久久久久一区二区 | 国产精品69毛片高清亚洲 | 成人福利 | 一级a性色生活片久久毛片 午夜精品在线观看 | 日韩三片| 欧美精品一区二区三区四区五区 | 欧美日韩精品一区二区三区视频 | 国产免费又黄又爽又刺激蜜月al | 久久精品国产免费一区二区三区 | 久久久久久国产精品 | 粉嫩高清一区二区三区 | 日韩在线视频一区 | 国产视频中文字幕 | 国产欧美一区二区三区日本久久久 | 91xxx在线观看 | 成人午夜精品 | 亚洲福利片 | 日韩av在线免费 | 欧美一区二区三区视频 | 久久久久网站 | 国产乱码久久久 | 国产日韩欧美在线观看 | 超碰免费在线观看 | 成人国产精品一级毛片视频毛片 | 黄色免费观看网站 | 欧美在线观看一区二区 | 日日草夜夜草 | 国产精品一二区 |