I have created the following file to do CRON job for updating the thread info but i get the following error msg whenever I run it ....
Fatal error: Call to a member function query_first_slave() on a non-object in /xxx/yyy/zzz/global.php on line 242
Can anyone explain what the above means???
Quote:
<?php
require_once ('./global.php');
require_once('./includes/functions_databuild.php');
/*
updateCounters.php
*/
if (empty($vbulletin->GPC['perpage']))
{
$vbulletin->GPC['perpage'] = 100;
}
echo '<p>' . $vbphrase['updating_forums'] . '</p>';
$forums = $db->query_read("
SELECT forumid
FROM " . TABLE_PREFIX . "forum
WHERE forumid >= " . $vbulletin->GPC['startat'] . "
ORDER BY forumid
LIMIT " . $vbulletin->GPC['perpage']
);
$finishat = $vbulletin->GPC['startat'];
while($forum = $db->fetch_array($forums))
{
build_forum_counters($forum['forumid'], true);
echo construct_phrase($vbphrase['processing_x'], $forum['forumid']) . "<br />\n";
vbflush();
$finishat = ($forum['forumid'] > $finishat ? $forum['forumid'] : $finishat);
}
$finishat++;
if ($checkmore = $db->query_first("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE forumid >= $finishat LIMIT 1"))
{
print_cp_redirect("misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=updateforum&startat=$finishat&pp=" . $vbulletin->GPC['perpage']);
echo "<p><a href=\"misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=updateforum&startat=$finishat&pp=" . $vbulletin->GPC['perpage'] . "\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>";
}
else
{
// get rid of "ghost" moderators who are not attached to a valid forum
$deadmods = $db->query_read("
SELECT moderatorid
FROM " . TABLE_PREFIX . "moderator AS moderator
LEFT JOIN " . TABLE_PREFIX . "forum AS forum USING (forumid)
WHERE forum.forumid IS NULL AND forum.forumid <> -1
");
$mods = '';
while ($mod = $db->fetch_array($deadmods))
{
if (!empty($mods))
{
$mods .= ' , ';
}
$mods .= $mod['moderatorid'];
}
if (!empty($mods))
{
$db->query_write("DELETE FROM " . TABLE_PREFIX . "moderator WHERE moderatorid IN (" . $mods . ")");
}
// and finally rebuild the forumcache
unset($forumarraycache, $vbulletin->forumcache);
build_forum_permissions();
define('CP_REDIRECT', 'misc.php');
print_stop_message('updated_forum_successfully');
}
?>
|