2021-04-17, 01:27 PM
(This post was last modified: 2021-04-17, 03:30 PM by HLFadmin. Edited 2 times in total.)
Trying to reset the mostonline variable each week.
I took a look at the code in index.php, lines 341+ and created this task resetmostonline.php
It neither resets the variable nor creates a log entry. I've created a new task entry in AdminCP / Tools & Maintenance / Task Manager / Add Task.
When I hit Run Task, it stays stuck with a blank screen. If I reload the page I get mack to task manager with a green message "task ran successfully", but checking cache value and Task Log, get no results.
[edited code to fix the variable and the globals]
I took a look at the code in index.php, lines 341+ and created this task resetmostonline.php
It neither resets the variable nor creates a log entry. I've created a new task entry in AdminCP / Tools & Maintenance / Task Manager / Add Task.
When I hit Run Task, it stays stuck with a blank screen. If I reload the page I get mack to task manager with a green message "task ran successfully", but checking cache value and Task Log, get no results.
<?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_resetmostonline($task)
{
global $cache;
$mostonline = $cache->read('mostonline');
$time = TIME_NOW;
$mostonline['numusers'] = 1;
$mostonline['time'] = $time;
$cache->update('mostonline', $mostonline);
add_task_log($task, "Reset Most Online");
}
[edited code to fix the variable and the globals]