Fixes for cache getPaymentsData(), renamed variable 'pid' to 'paymentsId'
authorRoland Häder <roland@mxchange.org>
Sun, 30 Sep 2012 20:11:03 +0000 (20:11 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 30 Sep 2012 20:11:03 +0000 (20:11 +0000)
inc/mysql-manager.php

index 625598d66e02d782deb982ea8f7e4dc04783304a..c6924af0574fc5ad5e591a42c6a9bf7cfb6031b7 100644 (file)
@@ -870,12 +870,12 @@ function getCategory ($cid) {
 }
 
 // Get a string of "mail title" and price back
-function getPaymentTitlePrice ($pid, $full = false) {
+function getPaymentTitlePrice ($paymentsId, $full = false) {
        // Only title or also including price?
        if ($full === false) {
-               $ret = getPaymentData($pid, 'main_title');
+               $ret = getPaymentData($paymentsId, 'main_title');
        } else {
-               $ret = getPaymentData($pid, 'main_title') . ' / {%pipe,getPaymentData,translateComma=' . $pid . '%} {?POINTS?}';
+               $ret = getPaymentData($paymentsId, 'main_title') . ' / {%pipe,getPaymentData,translateComma=' . $paymentsId . '%} {?POINTS?}';
        }
 
        // Return result
@@ -883,15 +883,14 @@ function getPaymentTitlePrice ($pid, $full = false) {
 }
 
 // "Getter" for payment data (cached)
-function getPaymentData ($pid, $lookFor = 'price') {
+function getPaymentData ($paymentsId, $lookFor = 'price') {
        // Default value...
        $data[$lookFor] = NULL;
 
        // Do we have cache?
-       if (isset($GLOBALS['cache_array']['payments']['id'][$pid])) {
+       if (isset($GLOBALS['cache_array']['payments'][$paymentsId]['id'])) {
                // Use it if found to save SQL queries
-               die('<pre>'.print_r($GLOBALS['cache_array']['payments'],true).'</pre>');
-               $data[$lookFor] = $GLOBALS['cache_array']['payments'][$lookFor][$pid];
+               $data[$lookFor] = $GLOBALS['cache_array']['payments'][$lookFor][$paymentsId];
 
                // Update cache hits
                incrementStatsEntry('cache_hits');
@@ -900,7 +899,7 @@ function getPaymentData ($pid, $lookFor = 'price') {
                $result = SQL_QUERY_ESC('SELECT `%s` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1',
                        array(
                                $lookFor,
-                               bigintval($pid)
+                               bigintval($paymentsId)
                        ), __FUNCTION__, __LINE__);
 
                // Is the entry there?