Cron in oxid 4.5.4

Hi All,

I am using OXID 4.5.4 and I want to run a cron file from my root like http://www.mysite.com/myfile.php

Now in myfile.php i have added below lines to use oxid default functionality

require getShopBasePath() . ‘modules/functions.php’;
require_once(getShopBasePath(). “core/oxfunctions.php”);
require_once(getShopBasePath() .“core/adodblite/adodb.inc.php”);

function getShopBasePath()
{
return dirname(FILE). “/”;
}

now after this if i am initialize db using this $oDb = oxDb::getDb();

It gives me below error
Fatal error: Class ‘oxDb’ not found in …\oxid454-core\core\oxconfig.php on line 478

Can anyone tell me why this error is coming or do i need to add any additional lines to use default functionality?

Note: This is working perfectly in OXID 4.4.8 but it creates problem in OXID 4.5.4.

Hi,
try to use these classes as required classes:

require_once(getShopBasePath().“core/oxfunctions.php”);
require_once(getShopBasePath().“core/oxutils.php”);
require_once(getShopBasePath().“core/oxconfig.php”);
require_once(getShopBasePath().“core/adodblite/adodb.inc.php”);
require_once(getShopBasePath(). “modules/functions.php”);

Regards,

Fabian

Alpha-Sys…
Thanks for the reply but it still gives same error.

Hi,
ok, he couldn’t find the oxdb class.
Maybe you have to include the oxdb class separately in the newer versions.

add this entry:
require_once(getShopBasePath().“core/oxdb.php”);

Regards,

Fabian

Thanks. its running now.

the code in your first post looks quite right, the only thing i think it’s missing is:


$config = oxConfig::getInstance();

For some reason this is needed sometimes to load all classes.

The code you need is also used in index.php, copy everything except for some ADODB special stuff and your cronjob will work properly.

Btw: It’s not very secure to place cronjobs in the root folder of the shop, try placing it in a subfolder where the file is not reachable via webbrowser.