X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   General talk (https://forum.x-cart.com/forumdisplay.php?f=29)
-   -   Upgrade your store (https://forum.x-cart.com/showthread.php?t=38953)

kenneth 11-24-2008 05:02 PM

Re: Upgrade your store
 
I've just upgraded my 4.0.12 to 4.0.17 and applied the Mysql 5 patch. Several files had to be manually patched during the upgrade because of custom site modifications.

I have this on a test box and have discovered one problem, the anonymous check out button is no longer working as is the modify profile for login accounts. Other buttons appear to work but have only finished the upgrade this evening, so it isn't heavily tested yet.

I'm a newbie at this but managed to get this far. Any advice on where to look for the problems? It's not throwing out any SQL errors. It's as if the buttons are no longer connected.

Mysql 5.0
php 5

Thanks

Ken

html_sucks 03-27-2009 11:56 AM

Re: Upgrade your store
 
hi,
could anyone please tell me if I can upgrade from 4.0.13 to 4.0.19 at once or do I have to upgrade first to 4.0.17, then to 4.0.18 and then to 4.0.19 ? I just need sql upgrade but in File Area there's only sql upgrade for 4.0.19-4.1.11

Dawn 03-28-2009 04:25 PM

Re: Upgrade your store
 
Somewhat frustrated here. Can't run the patch as it claims it's already patched (it isn't) and no one seems willing to explain manually patching the one file (or I've managed to miss it). I get that the "-" means remove and "+" means add, but there are lines that don't exist in the right place in the original file that it has neither "+" nor "-" next to.
Confusing.
The latter half of the patch has this:
Quote:

function db_select_db($sql_db) {
@@ -51,6 +53,10 @@
global $debug_mode;
global $mysql_autorepair;

+ if(MYSQL5 && preg_match("/\s*SELECT/i", $query)) {
+ $query = preg_replace("/FROM([^\"\']+?)LEFT\s+?JOIN/is","FROM($1)LEFT JOIN",$query);
+ }
+
if(defined("START_TIME")) {
global $__sql_time;
$t = func_microtime();
if(defined("START_TIME")) is actually defined lower down in another function: "function db_query($query)", as are the two globals, not in the one given in the patch:
Quote:

function db_select_db($sql_db) {
return mysql_select_db($sql_db) || die("Could not connect to SQL db");
}

How do you manually patch? Can someone show an example of a patched section from lines 40-70 or so?

I should mention I tried adding in just the "+" lines and removing the "-" lines, but the mysql errors persist, same as before.

Dawn 03-28-2009 05:07 PM

Re: Upgrade your store
 
Quote:

Originally Posted by Dawn
if(defined("START_TIME")) is actually defined lower down in another function: "function db_query($query)", as are the two globals, not in the one given in the patch:

That explained it. I was assuming because it was showing this line "function db_select_db($sql_db)" that the lines needed to go there. The lines above and below that show the context of the section to edit exist in the query just below that for whatever reason. Added the lines to that function "function db_query($query)" and it's working now.

Weird, but done. ;)

bobb 07-28-2009 06:13 AM

Re: Upgrade your store
 
The patch on page 7 of this thread did not work for me. Qualiteam support provided the patch below, which fixed our X-Cart 4.0.x and MySQL 5.x incompatibility problem. :D/

This was applied to a server running FreeBSD with Apache 2.2.1, MYSQL 5.0.84, PHP 5.2.10.

If you apply the patch manually, make a backup of \include\func.php and do the 2nd section 1st so the line #'s are a help. Or have Qualiteam install it for a nominal fee.

Code:

Index: include/func.php
--- /u/install/www/xcart_4_0_x/include/func.php        2008-07-05 08:14:26.000000000 +0400
+++ /u/seyfin/www/xcart_4_0_x/include/func.php        2009-07-01 08:09:15.000000000 +0400
@@ -36,6 +36,17 @@
 
 if ( !defined('XCART_START') ) { header("Location: ../"); die("Access denied"); }
 
+/* MySQL 5.0 Compatibility Code */
+define("MYSQL5", true);
+#define("MYSQL5",substr(mysql_get_server_info(),0,1)=="5");
+function upgrade_to_mysql_5($qry) {
+                if (strpos(strtoupper($qry),"SELECT")!==false) {
+                        $qry=preg_replace("/FROM([^\"\']+?)LEFT\s+?JOIN/is","FROM($1)LEFT JOIN",$qry);
+                }
+                return $qry;
+}
+/* End Compatibility Code */
+
 #
 # Database abstract layer functions
 #
@@ -55,7 +66,12 @@
                        global $__sql_time;
                        $t = func_microtime();
                }
+
+                /* Check for MySQL 5 */
+                if (MYSQL5) $query = upgrade_to_mysql_5($query);
                $result = mysql_query($query);
+                /* End MySQL 5 check */
+
                if(defined("START_TIME")) {
                        $__sql_time += func_microtime()-$t;
                }



All times are GMT -8. The time now is 07:50 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.