function shrinktheweb_addRequestToDB in ShrinkTheWeb 6
Adding request to debug log table
1 call to shrinktheweb_addRequestToDB()
- shrinktheweb_checkWebsiteThumbnailCaptured in ./
shrinktheweb.api.inc - Method that checks if the thumbnail for the specified website exists
File
- ./
shrinktheweb.api.inc, line 307
Code
function shrinktheweb_addRequestToDB($aSTWArgs, $aResponse, $sHash) {
$iTimestamp = time();
$sQueryUpdate = "UPDATE `shrinktheweb_log` SET `timestamp` = '" . $iTimestamp . "', `capturedon` = '" . $aResponse['stw_last_captured'] . "', `invalid` = '" . $aResponse['invalid'] . "',\n \t\t`stwerrcode` = '" . $aResponse['stw_response_code'] . "', `error` = '" . $aResponse['error'] . "', `errcode` = '" . $aResponse['stw_response_status'] . "' WHERE `hash` = '" . $sHash . "'";
$sQueryInsert = "INSERT INTO `shrinktheweb_log` SET `domain` = '" . $aSTWArgs['stwurl'] . "', `timestamp` = '" . $iTimestamp . "', `capturedon` = '" . $aResponse['stw_last_captured'] . "',\n \t\t`quality` = '" . $aSTWArgs['stwqual'] . "', `full` = '" . $aSTWArgs['stwfull'] . "', `xmax` = '" . $aSTWArgs['stwxmax'] . "', `ymax` = '" . $aSTWArgs['stwymax'] . "',\n \t\t`nrx` = '" . $aSTWArgs['stwnrx'] . "', `nry` = '" . $aSTWArgs['stwnry'] . "', `invalid` = '" . $aResponse['invalid'] . "', `stwerrcode` = '" . $aResponse['stw_response_code'] . "',\n \t\t`error` = '" . $aResponse['error'] . "', `errcode` = '" . $aResponse['stw_response_status'] . "', `hash` = '" . $sHash . "'";
// check if there is an entry existing with this hash
db_query($sQueryUpdate);
if (db_affected_rows() == 0) {
// doesn't exist
db_query($sQueryInsert);
}
}