我需要在x-cart4.4.4 (https://help.x-cart.com/index.php?title=X-Cart:X-PDF_Invoices)中安装一个模块。
X-cart在根目录中,但安装的模块在root/modules中。安装说明建议解压所有模块目录并将其移动到根目录下进行安装。
这是我不能做的事情-模块的内容包括与根目录中的文件和文件夹同名的文件和文件夹。
相反,我将内容解压到root/modules/的一个子目录中。在安装脚本中,我已经将cwd更改为根目录,用于修复未找到的文件错误,但是当它到达x-cart install.php时,它会中断,并且我得到一个错误(在nginx日志中没有显示错误)。
例如:
//change cwd to root
chdir(str_replace('modules/X_PDF', '', __DIR__));
if (!@include('./top.inc.php')) {
die('X-Cart not found in '.dirname(__FILE__));
}
if (!@include('./init.php')) {
die('init.php not found. Please, unpack ' . $module_definition['name'] . ' module in <xcart> directory');
}这里我们需要x-cart安装脚本。文件路径正确,并且正在调用脚本。
require_once $xcart_dir . '/include/install.php';发布于 2016-12-16 23:29:21
这个补丁在4.7.6版本中适用于我。
您必须使模块的皮肤文件和模块/XPDF/*.php文件适应您的自定义目录。
Index: include/install.php
--- include/install.php
+++ include/install.php
@@ -500,7 +500,7 @@ function func_init_xcart() {
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $install_language_charset; ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title><?php echo_lng('install_wiz', 'product', $installation_product); ?></title>
-<link rel="stylesheet" type="text/css" href="skin/common_files/css/install.css" />
+<link rel="stylesheet" type="text/css" href="../../skin/common_files/css/install.css" />
<style type="text/css">
<?php
@@ -1064,6 +1064,7 @@ function query_upload($filename)
global $xcart_dir, $sql_obj;
$fp = @fopen($xcart_dir.XC_DS.$filename, 'rb');
+ $fp = $fp ?: @fopen($filename, 'rb');
if ($fp === false) {
echo_lng('upload_cannot_open', 'file', $filename, 'status', status(false));
return 0;
Index: install-xpdf.php
--- install-xpdf.php
+++ install-xpdf.php
@@ -55,6 +55,13 @@ $module_definition = array (
'is_installed' => 'func_is_installed',
);
+
+$module_definition['sql_files'] = array(
+ getcwd() . '/sql/'.$module_definition['prefix'].'_remove.sql',
+ getcwd() . '/sql/'.$module_definition['prefix'].'.sql',
+ getcwd() . '/sql/'.$module_definition['prefix'].'_lng_US.sql',
+);
+
if (
isset($_POST['params'])
&& isset($_POST['params']['install_type'])
@@ -65,6 +72,8 @@ if (
);
}
+chdir(str_replace('root/modules', '/', __DIR__));
+
if (!@include('./top.inc.php')) {
die('X-Cart not found in '.dirname(__FILE__));
}
@@ -73,7 +82,7 @@ if (!file_exists('skin')) {
die('Wrong X-Cart version');
}
-if (!@include(dirname(__FILE__).'/init.php')) {
+if (!@include(getcwd().'/init.php')) {
die('init.php not found. Please, unpack ' . $module_definition['name'] . ' module in <xcart> directory');
}
顺便说一下,您可以手动安装模块,只需
1)使用这些文件修补您的X-Cart
./include/history_order.php.patch
./include/func/func.mail.php.patch
./include/process_order.php.patch
./process_order.php.patch2)应用这些sql文件
sql/x-pdf_lng_US.sql
sql/x-pdf.sqlhttp://help.x-cart.com/index.php?title=X-Cart:Applying_Patches
https://stackoverflow.com/questions/41169069
复制相似问题