2023-03-05, 09:04 AM
hi there I set a task to delete the sessions and it succeeded, and this is the code in the file php
But I tried to try again with a schedule mybb_captcha but it didn't work unfortunately
The following collapse appears
[attachment=45835]
All I can find is help in fixing the code and possibly applying it to other tables
<?php
/**
* MyBB 1.8
* Copyright 2014 MyBB Group, All Rights Reserved
*
* Website: http://www.mybb.com
* License: http://www.mybb.com/about/license
*
*/
function task_clearsessions($task)
{
global $mybb, $db, $cache, $lang, $plugins;
$timeHours = 3;
$cutoff = TIME_NOW - ($timeHours * 3600);
$db->delete_query("sessions", "time < " . $cutoff);
add_task_log($task, "The custom clear sessions task successfully ran.");
}
But I tried to try again with a schedule mybb_captcha but it didn't work unfortunately
<?php
/**
* MyBB 1.8
* Copyright 2014 MyBB Group, All Rights Reserved
*
* Website: http://www.mybb.com
* License: http://www.mybb.com/about/license
*
*/
function task_clearcaptcha($task)
{
global $mybb, $db, $cache, $lang, $plugins;
$timeHours = 3;
$cutoff = TIME_NOW - ($timeHours * 3600);
$db->delete_query("captcha", "time < " . $cutoff);
add_task_log($task, "The custom clear captcha task successfully ran.");
}
The following collapse appears
Quote:MyBB SQL Error - [20] array ( 'error_no' => 1054, 'error' => 'Unknown column \'time\' in \'where clause\'', 'query' => 'DELETE FROM mybb_searchlog WHERE time < 1678006149', )This photo is from View Task Logs
[attachment=45835]
All I can find is help in fixing the code and possibly applying it to other tables