X-Cart:To apply a patch manually

From X-Cart 4 Classic
Revision as of 09:53, 30 September 2010 by Ivka (talk | contribs)
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 application
  • 10 - indicates the number of the lines in the hunk after patch application
Then follows the file code including lines 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 a 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 the patch, and remove them.
  • Insert the lines, which are marked by "+" in the text of the patch.