prestashop - Using Db::getInstance() in a CLI script -


i've been wanting create add-on cron script utilises prestashop's db class instead of instantiating database handle directly, can't seem figure out did "db" class commonly referenced "db::getinstance()" calls defined.

classes/db.php defines abstract dbcore class. mysqlcore extends db can see, db never defined anywhere:

[/home/xxxx/www/shop/classes]# grep -r "extends db" ../ ../classes/mysql.php:class mysqlcore extends db 

according thread on prestashop forums, abstract dbcore class implemented in class located in override/classes/db, directory not exist.

[/home/xxxx/www/shop/override]# cd ../override/ [/home/xxxx/www/shop/override]# ls ./  ../  classes/  controllers/ [/home/xxxx/www/shop/override]# cd classes/ [/home/xxxx/www/shop/override/classes]# ls ./  ../  _frontcontroller.php*  _module.php*  _mysql.php* 

our shop working, missing something. running prestashop 1.4.1, perhaps docs no longer applicable.

quite in many places in code base functions db class being used, last grep through code found nothing:

grep -rwi "db" . | grep -v "::" ./modules/productcomments/productcommentscriterion.php:require_once(dirname(__file__).'/../../classes/db.php'); ./classes/mysql.php:class mysqlcore extends db ./classes/db.php:  * db object instance (singleton) ./classes/db.php:  * @return object db instance ./classes/db.php:  * build db object 

is there missing? did magical db class come from?

to create cli script, easiest way include config file have access every classes. example

<?php     require dirname(__file__).'/config/config.inc.php'; // assuming script in root folder of site     // can access      $db = db::getinstance(); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -