/** * Runs this cron task. * * @return null */ public function run() { if (!function_exists('auto_prune')) { include $this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext; } if ($this->forum_data['prune_days']) { auto_prune($this->forum_data['forum_id'], 'posted', $this->forum_data['forum_flags'], $this->forum_data['prune_days'], $this->forum_data['prune_freq']); } if ($this->forum_data['prune_viewed']) { auto_prune($this->forum_data['forum_id'], 'viewed', $this->forum_data['forum_flags'], $this->forum_data['prune_viewed'], $this->forum_data['prune_freq']); } }
/** * Runs this cron task. * * @return null */ public function run() { if (!function_exists('auto_prune')) { include $this->src_root_path . 'includes/functions_admin.' . $this->php_ext; } $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq FROM ' . FORUMS_TABLE . "\n\t\t\tWHERE enable_prune = 1\n\t\t\t\tAND prune_next < " . time(); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { if ($row['prune_days']) { auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']); } if ($row['prune_viewed']) { auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']); } } $this->db->sql_freeresult($result); }
} // Do the forum Prune thang if ($row['prune_next'] < time() && $row['enable_prune']) { include_once $phpbb_root_path . 'includes/functions_admin.' . $phpEx; if ($row['prune_days']) { if ($use_shutdown_function) { register_shutdown_function('auto_prune', $row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']); } else { auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']); } } if ($row['prune_viewed']) { if ($use_shutdown_function) { register_shutdown_function('auto_prune', $row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']); } else { auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']); } } } break; } // Unloading cache and closing db after having done the dirty work. if ($use_shutdown_function) { register_shutdown_function('unlock_cron'); register_shutdown_function('garbage_collection'); } else { unlock_cron(); garbage_collection(); } exit; /**
$message = $lang['Topics_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "={$forum_id}") . '">', '</a> '); message_die(GENERAL_MESSAGE, $message); } // // End handle marking posts // $tracking_topics = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : ''; $tracking_forums = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : ''; // // Do the forum Prune // if ($is_auth['auth_mod'] && $board_config['prune_enable']) { if ($forum_row['prune_next'] < time() && $forum_row['prune_enable']) { include $phpbb_root_path . 'includes/prune.' . $phpEx; require $phpbb_root_path . 'includes/functions_admin.' . $phpEx; auto_prune($forum_id); } } // // End of forum prune // // // Obtain list of moderators of each forum // First users, then groups ... broken into two queries // $sql = "SELECT u.user_id, u.username \n\tFROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u\n\tWHERE aa.forum_id = {$forum_id} \n\t\tAND aa.auth_mod = " . TRUE . " \n\t\tAND g.group_single_user = 1\n\t\tAND ug.group_id = aa.group_id \n\t\tAND g.group_id = aa.group_id \n\t\tAND u.user_id = ug.user_id \n\tGROUP BY u.user_id, u.username \n\tORDER BY u.user_id"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql); } $moderators = array(); while ($row = $db->sql_fetchrow($result)) {
$_CLASS['core_display']->meta_refresh(3, generate_link('Forums&file=viewforum&f=' . $forum_id)); $message = $_CLASS['core_user']->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_FORUM'], '<a href="' . generate_link('Forums&file=viewforum&f=' . $forum_id) . '">', '</a> '); trigger_error($message); } // Is a forum specific topic count required? if ($forum_data['forum_topics_per_page']) { $config['topics_per_page'] = $forum_data['forum_topics_per_page']; } // Do the forum Prune thang - cron type job ... if ($forum_data['prune_next'] < time() && $forum_data['enable_prune']) { require_once $site_file_root . 'includes/forums/functions_admin.php'; if ($forum_data['prune_days']) { auto_prune($forum_id, 'posted', $forum_data['forum_flags'], $forum_data['prune_days'], $forum_data['prune_freq']); } if ($forum_data['prune_viewed']) { auto_prune($forum_id, 'viewed', $forum_data['forum_flags'], $forum_data['prune_viewed'], $forum_data['prune_freq']); } } if ($_CLASS['auth']->acl_get('f_subscribe', $forum_id)) { $notify_status = isset($forum_data['notify_status']) ? $forum_data['notify_status'] : NULL; $s_watching_forum = watch_topic_forum('forum', $_CLASS['core_user']->data['user_id'], $forum_id, 0, $notify_status); } else { $s_watching_forum['link'] = $s_watching_forum['title'] = ''; } gen_forum_auth_level('forum', $forum_id); // Topic ordering options $limit_days = array(0 => $_CLASS['core_user']->lang['ALL_TOPICS'], 1 => $_CLASS['core_user']->lang['1_DAY'], 7 => $_CLASS['core_user']->lang['7_DAYS'], 14 => $_CLASS['core_user']->lang['2_WEEKS'], 30 => $_CLASS['core_user']->lang['1_MONTH'], 90 => $_CLASS['core_user']->lang['3_MONTHS'], 180 => $_CLASS['core_user']->lang['6_MONTHS'], 364 => $_CLASS['core_user']->lang['1_YEAR']); $sort_by_text = array('a' => $_CLASS['core_user']->lang['AUTHOR'], 't' => $_CLASS['core_user']->lang['POST_TIME'], 'r' => $_CLASS['core_user']->lang['REPLIES'], 's' => $_CLASS['core_user']->lang['SUBJECT'], 'v' => $_CLASS['core_user']->lang['VIEWS']); $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); $sort_key = !in_array($sort_key, array('a', 't', 'r', 's', 'v')) ? 't' : $sort_key; $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';