注意: 此问题似乎适用于已收到SUPEE-6788补丁的所有Magento版本。您会在我的答案中看到这两者, .htaccess
并且都.htaccess.sample
需要还原才能使补丁成功。
我正在使用提供的shell脚本应用SUPEE-6788补丁到CE 1.7.0.2网站magentocommerce.com/downloads。该站点已应用了所有以前的安全补丁。
脚本的名称是PATCH_SUPEE-6788_CE_1.7.0.2_v1-2015-10-27-12-00-16.sh
且具有md5sum cfc0cf533fe36a5f573414f0feeb1590
(此修补程序是不寻常的,因为它未经压缩就被释放了-尽管该文件未显示损坏或被截断)。
运行此脚本时,控制台输出似乎表明所包含的补丁程序中至少有一个失败或被跳过,但是补丁程序的许多部分均已成功执行,但是git
未显示任何更改。该脚本已在具有相同代码库的两个不同环境中进行了测试-一个是Ubuntu GNOME 14.04 LTS工作站,另一个是nexcess.com共享服务器(运行CentOS)。
有趣的是,两种环境的输出略有不同。注意以“ checking”和“ patching”开头的行。
Ubuntu环境的输出示例:
bash PATCH_SUPEE-6788_CE_1.7.0.2_v1-2015-10-27-12-00-16.sh [19:27:10]
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.
checking file .htaccess
Hunk #1 FAILED at 207.
1 out of 1 hunk FAILED
can't find file to patch at input line 38
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git .htaccess.sample .htaccess.sample
|index 546f18e..3e79c77 100644
|--- .htaccess.sample
|+++ .htaccess.sample
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
checking file app/code/core/Mage/Admin/Model/Block.php
checking file app/code/core/Mage/Admin/Model/Resource/Block.php
checking file app/code/core/Mage/Admin/Model/Resource/Block/Collection.php
checking file app/code/core/Mage/Admin/Model/Resource/Variable.php
checking file app/code/core/Mage/Admin/Model/Resource/Variable/Collection.php
checking file app/code/core/Mage/Admin/Model/Variable.php
...
来自CentOS环境的样本:
bash PATCH_SUPEE-6788_CE_1.7.0.2_v1-2015-10-27-12-00-16.sh
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.
patching file .htaccess
Hunk #1 FAILED at 207.
1 out of 1 hunk FAILED -- saving rejects to file .htaccess.rej
can't find file to patch at input line 38
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git .htaccess.sample .htaccess.sample
|index 546f18e..3e79c77 100644
|--- .htaccess.sample
|+++ .htaccess.sample
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
patching file app/code/core/Mage/Admin/Model/Block.php
patching file app/code/core/Mage/Admin/Model/Resource/Block.php
patching file app/code/core/Mage/Admin/Model/Resource/Block/Collection.php
patching file app/code/core/Mage/Admin/Model/Resource/Variable.php
...
我将在输出的顶部挖掘错误,并可能手动应用补丁程序,但希望有人可能对原因或相对简单的修复有所了解。
.htaccess
-File在文件末尾恰好有1个空换行符#FileETag none
。并且.htaccess.sample
文件末尾必须有2个空换行符。