! Been too long since I wrote the scheduled task code originally... firstly it wouldn't be called properly due to shd_init() now being after the scheduled task launch, and secondly because shd_init() hasn't run, certain values are not available (and it's not particularly smart to bootstrap SD just for 3 numbers). Still, the scheduled daily maintenance now works properly. [Bug 709]
gruffen

gruffen commited on 2011-05-28 03:32:50
Showing 2 changed files, with 2 additions and 2 deletions.

... ...
@@ -60,7 +60,7 @@ function shd_scheduled_close_tickets()
60 60
 			AND hdt.last_updated <= {int:time} - (86400 * hdd.autoclose_days)
61 61
 			AND hdt.status IN ({array_int:open})',
62 62
 		array(
63
-			'open' => array(TICKET_STATUS_NEW, TICKET_STATUS_PENDING_STAFF, TICKET_STATUS_PENDING_USER),
63
+			'open' => array(0, 1, 2), // TICKET_STATUS_NEW, TICKET_STATUS_PENDING_STAFF, TICKET_STATUS_PENDING_USER aren't declared when running scheduled tasks
64 64
 			'time' => time(),
65 65
 		)
66 66
 	);
... ...
@@ -1544,7 +1544,7 @@ function scheduled_simpledesk()
1544 1544
 {
1545 1545
 	global $sourcedir, $modSettings;
1546 1546
 
1547
-	if (empty($modSettings['helpdesk_active']))
1547
+	if (empty($modSettings['admin_features']) || !in_array('shd', explode(',', $modSettings['admin_features'])))
1548 1548
 		return;
1549 1549
 
1550 1550
 	require($sourcedir . '/sd_source/SimpleDesk-Scheduled.php');
1551 1551