#!/usr/bin/perl

########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

sub update_cronjobs_300 {
	&inst_description(&ltext("Updating Cronjobs"));
	use Modules::Cronjobs qw(&get_crontab);

	my $dbh = &inst_db_connection();
	my $sth_fill = $dbh->prepare(
		"INSERT INTO cronjobs (kunde, cronfile, neu, lastchange) VALUES(?, ?, ?, ?)");
		
	my $sth = $inst_dbh->prepare("SELECT kunde FROM kunden");
	$sth->execute;
	while (my($kunde) = $sth->fetchrow_array) {
		my $cronfile = &get_crontab($kunde);
		next unless ($cronfile);
		$dbh->do("DELETE FROM cronjobs WHERE kunde='$kunde'")
			or die("Error #001 in update_cronjobs_300() routine: $DBI::errstr\n");
		$sth_fill->execute($kunde, $cronfile, '0', time())
			or die("Error #002 in update_cronjobs_300() routine: $DBI::errstr\n");
	}
	&inst_finish_ok();
}

1;
