X-Cart:To apply a patch manually

From X-Cart 4 Classic
Revision as of 10:40, 13 September 2010 by Ivka (talk | contribs) (Created page with '1. Open the diff file in a text editor; : Diff files are divided into parts ("hunks"). Each "hunk" starts with a line like this: <pre>@@ -67,7 +67,10 @@</pre> : where: :* 67 -…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

1. Open the diff file in a text editor;

Diff files are divided into parts ("hunks"). Each "hunk" starts with a line like this:
@@ -67,7 +67,10 @@
where:
  • 67 - indicates the number of the line of the code where the changes start
  • 7 - indicates the number of the lines in the hunk before patch applying
  • 10 - indicates the number of the lines in the hunk after patch applying
Then follows the file code marked with "+" and "-" signs. Lines marked with "+" are the lines that you need to add in the file that you should patch. Lines marked with "-" are the lines that you need to remove from the file that you should patch.
Under 'Index:' you will find the name of the file that you should patch, for example:
Index: admin/category_modify.php
Here is an example of complete diff file:
Index: admin/category_modify.php
@@ -67,7 +67,10 @@
#

if ($shop_language == $config['default_admin_language']) {
-
func_array2update("categories", $category_lng, "categoryid = '$cat'");
+			$_category_lng = $category_lng;
+
if (empty($_category_lng['category']))
+
func_unset($_category_lng, 'category');
+
func_array2update("categories", $_category_lng, "categoryid = '$cat'");
}

$category_lng['code'] = $shop_language;

2. Edit the file (in our example, admin/category_modify.php):

  • Find the lines, which are marked by "-" in the text of patch, and remove them.
  • Insert the lines, which are marked by "+" in the text of patch.

If you cannot apply the patch in these ways it means the file that needs to be patched has been modified or this file is from another version of X-Cart and cannot be patched by this patch. Ask technical support to help you.