Help me understand a snippet

I’m new, not a coder.

I have a bit of custom code that should delete a DB row after X time.

Purpose: a user on a cart clicks Continue to checkout, and the user is redirected to a stripe payment page.
Before the redirect, the code writes the user to the DB.

From the payment page, if the user does not complete a successful transaction within X time, the code should delete the user record from the DB.

I paid a few dollars for custom code in a controller file to perform the delete:

public static function removeDonors()
{
	$db = Factory::getDbo();
	$config = Factory::getConfig();
	$date = Factory::getDate('now -6 hours', $config->get('offset'));
	$date->setTimezone(new DateTimeZone('UCT'));
	//echo $date->toSql(true);
	$db->setQuery("Delete from #__jd_donors where created_date <= '".$date->toSql(true)."' and published = '0'");
	$db->execute();	
}

Is the UCT a typo? Why doesn’t it cause a PHP error?

Is the “-6 hours” an adjustable parameter for setting a time limit? Or is it a reference to UTC?

I’m in a pickle. The old extension developer was skilled. The new developer seems less skilled or helpful. The new developer wrote the bit above.

If the code above is viable, I need to know how to adjust/shrink the time limit to a few minutes.

Thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service