pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

Magento 不支持模塊的卸載/降級有什么原因嗎

is there a reason why Magento shouldn#39;t support uninstall/downgrade for modules(Magento 不支持模塊的卸載/降級有什么原因嗎)
本文介紹了Magento 不支持模塊的卸載/降級有什么原因嗎的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

自動即時回滾是企業級部署機制的重要特性.目前,使用 Magento 的內置安裝工具無法實現這一點.

Automated instant rollback is an important feature of enterprise-grade deployment mechanisms. Currently, it's not possible to achieve this using Magento's built-in installation tools.

鑒于 Magento 的 core_resource 機制允許順序執行安裝或升級模塊的安裝腳本(通過執行 SQL 和 PHP),恕我直言,它應該支持相同的過程似乎是合乎邏輯的相反.

Given that Magento's core_resource mechanism allows for the sequential execution of setup scripts for installation or upgrade of modules (via execution of SQL and also PHP), it seems logical IMHO that it should support the same process in reverse.

現在,一些不支持它的明顯原因:

Now, some obvious reasons not to support it:

  1. 回滾腳本要獨立(并且可能是冪等的?)將具有挑戰性.我認為這不是避免該功能的正當理由,充其量只是一個借口.

  1. It would be challenging for the rollback scripts to be independent (and possibly idempotent?). I don't see this to be a valid reason to avoid the feature, it's an excuse at best.

其他模塊可能依賴于已安裝的模塊.模塊的 xml 聲明 節點可用于標記這些鏈接.

Other modules might have dependencies on the installed module. The module's xml declaration <depends/> node could be used to flag these linkages.

開發人員可能想要暫時禁用模塊而不進行完全卸載.這可能需要 xml 聲明 節點中的新狀態.

A developer might want to temporarily disable a module without doing a full uninstall. This could require a new status in the xml declaration <active/> node.

對您的想法感興趣.
京東

Interested in your thoughts.
JD

推薦答案

我看過一些關于此類的帖子,并且我自己也調查了 SQL 部署的相同場景.我不得不同意企業級 Magento 應該內置這種類型的功能.好消息是,至少在一些形式或時尚方面,我不確定它有多完整.以下是異常回滾示例:

I have seen some postings in regards to such and have investigated the same scenarios for SQL deployment myself. I would have to agree that being Enterprise grade Magento should have this type of functionality built-in. The good news it IS, at least in SOME form or fashion, how complete it is I'm not really sure. Here's a sample of a rollback upon exception:

try {
    $write = Mage::getSingleton('core/resource')->getConnection('core_write');
    $write->beginTransaction();

// do stuff here

    $write->commit();
} catch (Exception $e) {
    mage::log(__METHOD__ . ':' . __LINE__ . ': Rollback happened.');
    $write->rollback();
}

現在,如果您查看 app/code/core/Mage/Core/Model/Resource/Setup.php,您會發現很多有趣的方法.特別是:_getModifySqlFiles_rollbackResourceDb_modifyResourceDb.

Now if you take a look at app/code/core/Mage/Core/Model/Resource/Setup.php you'll find quite a bit of interesting methods. In particular: _getModifySqlFiles, _rollbackResourceDb and _modifyResourceDb.

_modifyResourceDb 對我來說是最有趣的,因為這里的 $actionType 也可以回滾和卸載 - 另請注意,您也可以將 PHP 文件用于安裝文件.

_modifyResourceDb is the most interesting to me, since the $actionType here can be rollback and uninstall as well - also note you can use PHP files for your setup files as well.

// Read resource files
$arrAvailableFiles = array();
$sqlDir = dir($sqlFilesDir);
while (false !== ($sqlFile = $sqlDir->read())) {
    $matches = array();
    if (preg_match('#^'.$resModel.'-'.$actionType.'-(.*).(sql|php)$#i', $sqlFile, $matches)) {
        $arrAvailableFiles[$matches[1]] = $sqlFile;
    }
}

這段代碼執行后:

$arrModifyFiles = $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrAvailableFiles);

但在這里我假設核心 Magento 開發人員迷失在 EAV 資源模型的內部,只是讓它部分完成.

But heres where I'm assuming core Magento devs got lost in the bowels of the EAV resource model and just left it partially complete.

protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles)
{
    $arrRes = array();

    switch ($actionType) {
        case 'install':
        case 'data-install':
...
        case 'rollback':
            break;

        case 'uninstall':
            break;
    }
    return $arrRes;
}

我還沒有機會真正測試上述內容,但僅從我對 magento 和自動加載的 ORM 的初步調查以及另一位開發人員對他的調查結果的投入來看.

I've not had a chance to really test out the above, but from just my initial investigations of the ORM that is magento and the Autoloading as well as another developer's input on his findings as well.

最終,如果我們可以在版本控制系統中保持所有更改至少模塊明智,那將是理想的.顯然,不應該以這種方式管理需要導入的龐大數據集,但是對于這些小的增量更改,我想推送到暫存、生產測試,如果失敗,則將其拉回一個版本,一切都恢復正常.

Ultimately it would be ideal if we can keep all of our changes at least module wise within a version controlled system. Obviously huge data sets that need to be imported shouldn't be managed this way but for these small incremental changes I want to push to staging, production test and if it fails pull it back one version and everything is back to normal.

顯然沒有一種理想的解決方案可以用于部署具有不同要求和需求的如此多的客戶,但執行此操作的通用方法將有助于代碼/SQL 部署.具有諷刺意味的是,Enterprise 有 CMS 登臺,以及代碼模塊化開發的能力,但 DB 卻沒有得到那么多的愛.

Obviously theres no one ideal solution for deployment with so many clients having different requirements and needs but a general way of doing this would help with code/SQL deployment. It's kind of ironic that Enterprise has CMS staging, and the ability for modular development of code, but the DB has not gotten as much love.

有一個相關的問題是指出我們目前如何使用一些自制"的專門腳本來做到這一點:

There is a related question that is noting how currently we are doing it with some specialized scripts "home-brewed" that essentially do:

執行 MySQLDump 或備份,然后替換 SQL 文件中的 BASE_URL.

Doing a MySQLDump or backup, then doing a replace on the BASE_URLs in the SQL file.

Magento 部署最佳實踐

另一個需要查看的工具是 Phing.

Another tool to look at would be Phing.

如果有人有時間調查似乎實施的回滾"和卸載"過程并報告他們的發現對我也有幫助.

If anyone has time to investigate the "rollback" and "uninstall" processes that seem to be implemented and report their findings would be helpful to me as well.

這篇關于Magento 不支持模塊的卸載/降級有什么原因嗎的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
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 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 网站建设,北京网站建设,北京网站建设公司,网站系统开发,北京网站制作公司,响应式网站,做网站公司,海淀做网站,朝阳做网站,昌平做网站,建站公司 | ALC墙板_ALC轻质隔墙板_隔音防火墙板_轻质隔墙材料-湖北博悦佳 | 越南专线物流_东莞国际物流_东南亚专线物流_行通物流 | 网站建设-网站制作-网站设计-网站开发定制公司-网站SEO优化推广-咏熠软件 | 变色龙云 - 打包app_原生app_在线制作平台_短链接_ip查询 | 精密机械零件加工_CNC加工_精密加工_数控车床加工_精密机械加工_机械零部件加工厂 | 聚合氯化铝价格_聚合氯化铝厂家_pac絮凝剂-唐达净水官网 | 西安耀程造价培训机构_工程预算实训_广联达实作实操培训 | 小程序开发公司_APP开发多少钱_软件开发定制_微信小程序制作_客户销售管理软件-济南小溪畅流网络科技有限公司 | 运动木地板价格,篮球馆体育运动木地板生产厂家_欧氏地板 | 发电机组|柴油发电机组-批发,上柴,玉柴,潍柴,康明斯柴油发电机厂家直销 | 舞台木地板厂家_体育运动木地板_室内篮球馆木地板_实木运动地板厂家_欧氏篮球地板推荐 | 铝镁锰板_铝镁锰合金板_铝镁锰板厂家_铝镁锰金属屋面板_安徽建科 | 多功能三相相位伏安表-变压器短路阻抗测试仪-上海妙定电气 | 精密模具加工制造 - 富东懿 | 全温恒温摇床-水浴气浴恒温摇床-光照恒温培养摇床-常州金坛精达仪器制造有限公司 | 仿清水混凝土_清水混凝土装修_施工_修饰_保护剂_修补_清水混凝土修复-德州忠岭建筑装饰工程 | 求是网 - 思想建党 理论强党| 双工位钻铣攻牙机-转换工作台钻攻中心-钻铣攻牙机一体机-浙江利硕自动化设备有限公司 | 便携式表面粗糙度仪-彩屏硬度计-分体式粗糙度仪-北京凯达科仪科技有限公司 | 日本东丽膜_反渗透膜_RO膜价格_超滤膜_纳滤膜-北京东丽阳光官网 日本细胞免疫疗法_肿瘤免疫治疗_NK细胞疗法 - 免疫密码 | 上海防爆真空干燥箱-上海防爆冷库-上海防爆冷柜?-上海浦下防爆设备厂家? | 杭州网络公司_百度SEO优化-外贸网络推广_抖音小程序开发-杭州乐软科技有限公司 | 高空重型升降平台_高空液压举升平台_高空作业平台_移动式升降机-河南华鹰机械设备有限公司 | 单锥双螺旋混合机_双螺旋锥形混合机-无锡新洋设备科技有限公司 | 桐城新闻网—桐城市融媒体中心主办 | 岛津二手液相色谱仪,岛津10A液相,安捷伦二手液相,安捷伦1100液相-杭州森尼欧科学仪器有限公司 | 帽子厂家_帽子工厂_帽子定做_义乌帽厂_帽厂_制帽厂_帽子厂_浙江高普制帽厂 | 短信通106短信接口验证码接口群发平台_国际短信接口验证码接口群发平台-速度网络有限公司 | 箱式破碎机_移动方箱式破碎机/价格/厂家_【华盛铭重工】 | 礼仪庆典公司,礼仪策划公司,庆典公司,演出公司,演艺公司,年会酒会,生日寿宴,动工仪式,开工仪式,奠基典礼,商务会议,竣工落成,乔迁揭牌,签约启动-东莞市开门红文化传媒有限公司 | 全国国际学校排名_国际学校招生入学及学费-学校大全网 | 低温柔性试验仪-土工布淤堵-沥青车辙试验仪-莱博特(天津)试验机有限公司 | 浇钢砖,流钢砖_厂家价低-淄博恒森耐火材料有限公司 | 流水线电子称-钰恒-上下限报警电子秤-上海宿衡实业有限公司 | 蜘蛛车-高空作业平台-升降机-高空作业车租赁-臂式伸缩臂叉装车-登高车出租厂家 - 普雷斯特机械设备(北京)有限公司 | PE一体化污水处理设备_地埋式生活污水净化槽定制厂家-岩康塑业 | 杭州中策电线|中策电缆|中策电线|杭州中策电缆|杭州中策电缆永通集团有限公司 | 防堵吹扫装置-防堵风压测量装置-电动操作显示器-兴洲仪器 | 应急灯_消防应急灯_应急照明灯_应急灯厂家-大成智慧官网 | 南京办公用品网-办公文具用品批发-打印机耗材采购 |