47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
// last execution: 2026-08-28 02:00:01
|
|
$par_Aantal_dagen_oud=120;
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Script start
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
log('warning', 'Executing ', name);
|
|
logAdd(log);
|
|
|
|
$p_days = $par_Aantal_dagen_oud;
|
|
logAdd(log, 'info', '#Dagen als parameter: ', $p_days);
|
|
|
|
ifThenElse($p_days,
|
|
ifThenElse($p_days < 3,
|
|
$p_days = 3;
|
|
,
|
|
ifThen($p_days > 120,
|
|
$p_days = 120;
|
|
);
|
|
);
|
|
,
|
|
$p_days = 90;
|
|
);
|
|
|
|
logAdd(log, 'info', '#Dagen na correctie: ', $p_days);
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Opschonen ledenupdates
|
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
$cleanup_date = datetime\addDays(datetime\now(), -1 * $p_days);
|
|
|
|
$ids = record\findMany('Ledenupdates', 'createdAt', 'desc', 'createdAt<', $cleanup_date);
|
|
$cnt = array\length($ids);
|
|
|
|
logAdd(log, 'info', '#Ledenupdates om te verwijderen: ', $cnt);
|
|
|
|
$i = 0;
|
|
$n = $cnt;
|
|
while($i < $n,
|
|
$id = array\at($ids, $i);
|
|
record\update('Ledenupdates', $id, 'deleted', true);
|
|
$i = $i + 1;
|
|
);
|
|
|
|
logAdd(log, 'info', 'Voor ', $cnt, ' records deleted = true gezet'); |