|
|
@ -17,6 +17,16 @@ $debug = [ |
|
|
|
'ISO8601' => date('c'), |
|
|
|
'ISO8601' => date('c'), |
|
|
|
'total' => microtime(true), |
|
|
|
'total' => microtime(true), |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
'http' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'total' => 0, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'memory' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'start' => memory_get_usage(), |
|
|
|
|
|
|
|
'total' => 0, |
|
|
|
|
|
|
|
'peaks' => 0 |
|
|
|
|
|
|
|
], |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
// Init Scraper |
|
|
|
// Init Scraper |
|
|
@ -121,17 +131,28 @@ try { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Debug output |
|
|
|
// Debug output |
|
|
|
$debug['time']['total'] = microtime(true) - $debug['time']['total']; |
|
|
|
$debug['time']['total'] = microtime(true) - $debug['time']['total']; |
|
|
|
|
|
|
|
|
|
|
|
print_r( |
|
|
|
$debug['memory']['total'] = memory_get_usage() - $debug['memory']['start']; |
|
|
|
array_merge($debug, [ |
|
|
|
$debug['memory']['peaks'] = memory_get_peak_usage(); |
|
|
|
'db' => [ |
|
|
|
|
|
|
|
'total' => [ |
|
|
|
$debug['db']['total']['select'] = $db->getDebug()->query->select->total; |
|
|
|
'select' => $db->getDebug()->query->select->total, |
|
|
|
$debug['db']['total']['insert'] = $db->getDebug()->query->insert->total; |
|
|
|
'insert' => $db->getDebug()->query->insert->total, |
|
|
|
$debug['db']['total']['update'] = $db->getDebug()->query->update->total; |
|
|
|
'update' => $db->getDebug()->query->update->total, |
|
|
|
$debug['db']['total']['delete'] = $db->getDebug()->query->delete->total; |
|
|
|
'delete' => $db->getDebug()->query->delete->total, |
|
|
|
|
|
|
|
] |
|
|
|
print_r($debug); |
|
|
|
] |
|
|
|
|
|
|
|
]) |
|
|
|
// Debug log |
|
|
|
); |
|
|
|
if (LOG_CRONTAB_SCRAPE_ENABLED) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
@mkdir(LOG_DIRECTORY, 0774, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($handle = fopen(LOG_DIRECTORY . '/' . LOG_CRONTAB_SCRAPE_FILENAME, 'a+')) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fwrite($handle, print_r($debug, true)); |
|
|
|
|
|
|
|
fclose($handle); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chmod(LOG_DIRECTORY . '/' . LOG_CRONTAB_SCRAPE_FILENAME, 0774); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |