Post by AndreyPopov » Fri Nov 01, 2019 12:12 am

use this driver Memcached Speed Booster
on OpenCart 2.3.0.2 work perfect

on OpenCart 3.0.3.x work, but with problem: not login to customer account at front-end

anybody know what differences with customer/login libraries between OpenCart 2.3 and 3.0?
Last edited by AndreyPopov on Tue Nov 05, 2019 7:53 am, edited 1 time in total.

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by IP_CAM » Fri Nov 01, 2019 11:02 am

Well, better don't try it, it won't work! I just made it, to very basically show you the Version Code difference: :laugh:

Code: Select all

<?php
namespace Cache;
	class Null {
    private $cache; 

//    public function __construct($expire) {}

    public function __construct($expire) {
		$this->expire = $expire; 

------------

//    public function set($key, $value) {
//        return true;
//   }

    public function set($key,$value) {
        $status = $this->cache->set($key, json_encode($value);
        if($status){
            $this->cache->$key, $this->expire);
        }
        return $status;
    }
 
------------

//    public function get($key) {
//        return false;
//    }

    public function get($key) {
        $data = $this->cache->get($key);
        return json_decode($data, true);
    }
 
------------

//    public function delete($key) {
//        return false;
//    }
//}

    public function delete($key) {
        $this->cache->delete($key); 

    }
}
But I fear, that nobody will re-create the Mod for you for free, better ask
the Fellow, who created the original, about a possible upgrade, or be
willing to pay somebody for the Job done.

Good Luck!
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by AndreyPopov » Fri Nov 01, 2019 7:08 pm

IP_CAM wrote:
Fri Nov 01, 2019 11:02 am
Well, better don't try it, it won't work!

But I fear, that nobody will re-create the Mod for you for free

Ernie
thanks for answer.

but I not use null.php, only mysqli_memcached.php

and OpenCart not accept Null class, only when I rename Null to NoCache, but I not use it.
I use memcached or redis cache.

question about mysqli_memcached.php
on OpenCart 2.3.0.2
db_engine = mysqli_memcached
cache_engine = memcached
all work! site "fly"! and customer can login to account.

on OpenCart 3.0.3.1
db_engine = mysqli_memcached
cache_engine = memcached

site "fly" but customer cannot login to account :(

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Fri Nov 01, 2019 7:38 pm

there is no message?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by straightlight » Fri Nov 01, 2019 9:24 pm

The customer cannot login into his account since the system/library/cart/customer.php file login method uses database password validation functions as opposed to the cache compared to the previous OC versions as well.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by AndreyPopov » Fri Nov 01, 2019 9:35 pm

letxobnav wrote:
Fri Nov 01, 2019 7:38 pm
there is no message?
any message
any errors

return again to login page

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Sat Nov 02, 2019 12:22 am

straightlight wrote:
Fri Nov 01, 2019 9:24 pm
The customer cannot login into his account since the system/library/cart/customer.php file login method uses database password validation functions as opposed to the cache compared to the previous OC versions as well.
I try compare system/library/cart/customer.php from 2.3.0.2 and 3.0.3.2 and one difference is:

2.3.0.2

Code: Select all

$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1' AND approved = '1'");
3.0.3.2

Code: Select all

$customer_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND (password = SHA1(CONCAT(salt, SHA1(CONCAT(salt, SHA1('" . $this->db->escape($password) . "'))))) OR password = '" . $this->db->escape(md5($password)) . "') AND status = '1'");
difference: AND approved = '1'

OpenCart 3.0 not contain column approved in customer table.



may be verification password in database in other library?

may be in password.php?

2.3.0.2

Code: Select all

if ((utf8_strlen($this->request->post['password']) < 4) || (utf8_strlen($this->request->post['password']) > 20))
3.0.3.2

Code: Select all

if ((utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) < 4) || (utf8_strlen(html_entity_decode($this->request->post['password'], ENT_QUOTES, 'UTF-8')) > 40)) 
?????

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Sun Nov 03, 2019 3:22 am

straightlight wrote:
Fri Nov 01, 2019 9:24 pm
The customer cannot login
also find this thread viewtopic.php?f=201&t=202589#p715995
all same like in it

customer can register
but after logout cannot login again.

sometimes after 10-15 attempts login successfull.
Last edited by AndreyPopov on Sun Nov 03, 2019 7:54 am, edited 1 time in total.

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Sun Nov 03, 2019 7:11 am

that extension caches select queries but excludes the cart table, why not also exlude selects on the customer table?

Code: Select all

$select_id = (0 <= stripos($sql, 'SELECT') && !stripos($sql, 'FROM ' . DB_PREFIX . 'cart')) ? sha1($sql) : false;

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Sun Nov 03, 2019 7:51 am

letxobnav wrote:
Sun Nov 03, 2019 7:11 am
that extension caches select queries but excludes the cart table, why not also exlude selects on the customer table?
exclude customer table not solve problem.

now even only product_id in query

Code: Select all

$select_id = (0 <= stripos($sql, 'SELECT p.product_id, (SELECT AVG(rating)') ) ? sha1($sql) : false;  
but this also not solve problem.

where and what yet can finding?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Sun Nov 03, 2019 9:16 am

well, that class "as-is" is basically "page-caching" all selects with the only exception whether there is "FROM ...cart" in the select, not even considering joins.
why not make it better by giving the class construct parameters like an array with tables to exclude and/or tables to include and/or tables update/inserts which invalidate the cache?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Sun Nov 03, 2019 10:59 am

letxobnav wrote:
Sun Nov 03, 2019 9:16 am
why not make it better by giving the class construct parameters like an array with tables to exclude and/or tables to include and/or tables update/inserts which invalidate the cache?
I only for make better!!!
but …. on OpenCart 3.0 customer cannot login (can register)

on OpenCart 2.3.0.2 mysqli_memcahed work "from box" and customer can register and login.

I can provide full access to my test site https://www.computersystems.fun - if you want to help solve problem.
(clean install of OpenCart 3.0.3.2 + mysqli_memcahed driver )

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Sun Nov 03, 2019 11:48 am

well, I do not have memcached installed, I do not cache queries and my normal OC cache files like theme, objects, etc. I put on RAM disk.

but add to cart also does not work on https://www.computersystems.fun

which is no surprise, like I said, it caches all selects except those that have a "FROM [prefix].cart" in it, of course that makes the site "fly", just not for very long...

What about the session table???

So perhaps make an inventory first of all selects in V3 and see which are eligible to be cached and which are not.
Then do the same for all table modify queries and determine which should make the cache invalid.

include those findings in the class.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Sun Nov 03, 2019 11:13 pm

letxobnav wrote:
Sun Nov 03, 2019 11:48 am
which is no surprise, like I said, it caches all selects except those that have a "FROM [prefix].cart" in it
now in driver I replace !!!!

Code: Select all

$select_id = (0 <= stripos($sql, 'SELECT') && !stripos($sql, 'FROM ' . DB_PREFIX . 'cart')) ? sha1($sql) : false;
to

Code: Select all

$select_id = (0 <= stripos($sql, 'SELECT p.product_id, (SELECT AVG(rating)') ) ? sha1($sql) : false;  
for testing (only SELECT p.product_id now caching)

P.S. site now "fly" because
- ssd hosting
- Opcache (Zend Optmizer) enabled
- memcached used like cache engine

really "fly" working project https://www.fancies.com.ua/ OpenCart 2.3.0.2 amd mysqli_memcached enabled



letxobnav wrote:
Sun Nov 03, 2019 11:48 am
What about the session table???
what see in session table?


all logins in session table

Code: Select all

session_id	data	expire	
e78e9afb01c48279ca3687234f	{"language":"en-gb","currency":"USD"}	2019-11-01 10:54:50	
e7ecc1369bef3ab12fe88cd03a	{"language":"en-gb","currency":"USD"}	2019-11-02 20:58:53	
e8a0962ccd21cdf6bbf777e5a1	{"language":"en-gb","currency":"USD"}	2019-11-02 17:20:33	
ea282a484c87612d80ef42c685	{"language":"en-gb","currency":"USD"}	2019-11-02 13:34:43	
eea8442b308b43fa43b87a0050	{"language":"en-gb","currency":"USD"}	2019-11-02 20:58:59	
f14b30c7730f40cfcb5fb4fcdc	{"language":"en-gb","currency":"USD"}	2019-11-02 17:20:35	
f2067f8f336cb0ecd480501080	{"language":"en-gb","currency":"USD"}	2019-11-02 20:59:00	
f3101fd15dd48e15e7964bc900	{"language":"en-gb","currency":"USD"}	2019-11-02 17:20:34	
f52916a08345a7d322cb996546	{"language":"en-gb","currency":"USD"}	2019-11-02 17:20:40	
f83dbb730d2955fb49ab8775bb	{"language":"en-gb","currency":"USD"}	2019-11-02 17:20:38	
f8b7fb185f6d77235602e688de	{"language":"en-gb","currency":"USD"}	2019-11-02 17:20:30	
fc608d50c269b8f69518b4a013	{"language":"en-gb","currency":"USD"}	2019-11-02 20:58:56	
fcbeb9dd8c174d3224ab56430f	{"language":"en-gb","currency":"USD"}	2019-11-02 17:20:32	
fefd4918fdb15871935840205f	{"language":"en-gb","currency":"USD"}	2019-11-02 13:27:59	
ff4ce17623b70e9211ec2f9825	{"language":"en-gb","currency":"USD"}	2019-11-02 20:58:57	
Last edited by AndreyPopov on Sun Nov 03, 2019 11:37 pm, edited 1 time in total.

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Sun Nov 03, 2019 11:36 pm

ok, so now you only cache the product select query.

I use sql prepared statements on the product table, also helps for multiple product queries like category, sitemap and search pages, really neat.

I would say, instead of defining in the driver which queries you can cache, define which you cannot cache.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Mon Nov 04, 2019 7:11 am

letxobnav wrote:
Sun Nov 03, 2019 11:36 pm
I would say, instead of defining in the driver which queries you can cache, define which you cannot cache.
this is next step after solve main problem : customer cannot login

any ideas what and where to find?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Mon Nov 04, 2019 9:42 am

why not list out all the queries it caches with memcached and see which query might give a problem if cached?

use:

Code: Select all

       if ($select_id && false !== $data = $this->_memcached->get($select_id)) {
		   error_log('memcached: '.$sql);
		   
		   [rest of code]
		   
then try to login and see if there are any queries cached related to customer login.
Maybe it are the queries used in the customer.php class or maybe the caching of queries on the session table if you use table for sessions.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Mon Nov 04, 2019 8:42 pm

letxobnav wrote:
Mon Nov 04, 2019 9:42 am
why not list out all the queries it caches with memcached and see which query might give a problem if cached?
thanks. now try.

but in my opinion, problem not I caching queries, problem in redirects between some modules and driver?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Mon Nov 04, 2019 10:38 pm

easy to test, don't cache anything and see if you still cannot login.
If you cannot, the problem is also elsewhere (it might also be the queries).
If you can, it are the cached queries for sure.

Code: Select all

$select_id = (0 <= stripos($sql, 'SELECT') && !stripos($sql, 'FROM ' . DB_PREFIX . 'cart')) ? sha1($sql) : false;
$select_id = false;

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Tue Nov 05, 2019 12:05 am

letxobnav wrote:
Mon Nov 04, 2019 9:42 am

use:

Code: Select all

       if ($select_id && false !== $data = $this->_memcached->get($select_id)) {
		   error_log('memcached: '.$sql);
		   
		   [rest of code]
		   
error_log('memcached: '.$sql); added

but

Code: Select all

2019-11-04 16:00:29 - PHP Notice:  Undefined property: DB\MySQLi_Memcached::$load in /home/priazhas/computersystems.fun/www/system/library/db/mysqli_memcached.php on line 53 


letxobnav wrote:
Mon Nov 04, 2019 10:38 pm

Code: Select all

$select_id = (0 <= stripos($sql, 'SELECT') && !stripos($sql, 'FROM ' . DB_PREFIX . 'cart')) ? sha1($sql) : false;
$select_id = false;
added
$select_id = false;
customer can login.
products can add to cart

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am
Who is online

Users browsing this forum: No registered users and 175 guests