how to debug the scheduling option for the php plugin

sales2010

Well-Known Member
Hello,

I don't know how can i debug this issue. I created a scheduled task using the php plugin. All is well when i test it using the "Run" button.

Next step was to see if the task is running on specified time. It does, but no information is submited to the database.

So I tried to see what happen with var_dump($query);exit; then i activated the log. Both options run well only if i press the "Run" button, but nothing happen for the scheduled task.

This is the code:

Code:
$sql1 = ("LOAD DATA INFILE 'D:/importuri/pc_daily/PC_DAILY.csv' INTO TABLE aplicatii_pc_daily FIELDS TERMINATED BY ',' ENCLOSED BY '\"' ESCAPED BY '\"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES (OFFER_ID,OFFER_NAME,OFFER_TYPE,CATEGORY,CATEGORY_BRM,UPDATE_DATE) set UPDATE_DATE = now()");
$db->setQuery($sql1);
$db->query();

Thank you
 
try adding some logging to the php code, to write out to a file what is happening when?
 
oh and I presume that the code there is just a snippet , as $db has not been declared?
 
Yes, the complete code is:

Code:
$db =& JFactory::getDBO();
$sql = ("Truncate table aplicatii_pc_daily");
$db->setQuery($sql);
$db->query();
$sql1 = ("LOAD DATA INFILE 'D:/importuri/pc_daily/PC_DAILY.csv' INTO TABLE aplicatii_pc_daily FIELDS TERMINATED BY ',' ENCLOSED BY '\"' ESCAPED BY '\"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES (OFFER_ID,OFFER_NAME,OFFER_TYPE,CATEGORY,CATEGORY_BRM,UPDATE_DATE) set UPDATE_DATE = now()");
$db->setQuery($sql1);
$db->query();
 
try adding some logging to the php code, to write out to a file what is happening when?

"So I tried to see what happen with var_dump($query);exit; then i activated the log. Both options run well only if i press the "Run" button, but nothing happen for the scheduled task"
 
Using Joomla's JLog class you can do this:
PHP:
// Include the JLog class.
jimport('joomla.log.log');
 
// Add the logger.
JLog::addLogger(array('text_file' => 'fabrik.log.php'));
 
// Start logging...
JLog::add(
'your message here',
JLog::NOTICE, 'com_fabrik');
 
[/code]
 
that will place a file in /logs/fabrik.log.php
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top