Ejemplo n.º 1
0
function makeCssEditData($db, $ts, $cssFile)
{
    $pageId = getCssPageId($db, $cssFile);
    if (!empty($pageId)) {
        echo "checking number of contributors...\n";
        $numContributors = countContributors($pageId, $ts, $db);
        echo "There is " . $numContributors . " contributors\n";
        $numEdits = countCssEdits($pageId, $ts, $db);
        echo "There is " . $numEdits . " edits\n";
    } else {
        $numContributors = $numEdits = 0;
        echo "ZERO\n";
    }
    return array($numContributors, $numEdits);
}
Ejemplo n.º 2
0
    /**
     * Recalculate all members post counts
     *
     * What it does:
     * - it requires the admin_forum permission.
     * - recounts all posts for members found in the message table
     * - updates the members post count record in the members table
     * - honors the boards post count flag
     * - does not count posts in the recyle bin
     * - zeros post counts for all members with no posts in the message table
     * - runs as a delayed loop to avoid server overload
     * - uses the not_done template in Admin.template
     * - redirects back to action=admin;area=maintain;sa=members when complete.
     * - accessed via ?action=admin;area=maintain;sa=members;activity=recountposts
     */
    public function action_recountposts_display()
    {
        global $txt, $context;
        // Check the session
        checkSession();
        // Set up to the context for the pause screen
        $context['page_title'] = $txt['not_done_title'];
        $context['continue_countdown'] = 3;
        $context['continue_get_data'] = '';
        $context['sub_template'] = 'not_done';
        // Init, do 200 members in a bunch
        $increment = 200;
        $_REQUEST['start'] = !isset($_REQUEST['start']) ? 0 : (int) $_REQUEST['start'];
        // Ask for some extra time, on big boards this may take a bit
        @set_time_limit(600);
        // The functions here will come in handy
        require_once SUBSDIR . '/Maintenance.subs.php';
        // Only run this query if we don't have the total number of members that have posted
        if (!isset($_SESSION['total_members']) || $_REQUEST['start'] == 0) {
            validateToken('admin-maint');
            $_SESSION['total_members'] = countContributors();
        } else {
            validateToken('admin-recountposts');
        }
        // Lets get the next group of members and determine their post count
        // (from the boards that have post count enabled of course).
        $total_rows = updateMembersPostCount($_REQUEST['start'], $increment);
        // Continue?
        if ($total_rows == $increment) {
            createToken('admin-recountposts');
            $_REQUEST['start'] += $increment;
            $context['continue_get_data'] = '?action=admin;area=maintain;sa=members;activity=recountposts;start=' . $_REQUEST['start'];
            $context['continue_percent'] = round(100 * $_REQUEST['start'] / $_SESSION['total_members']);
            $context['not_done_title'] = $txt['not_done_title'] . ' (' . $context['continue_percent'] . '%)';
            $context['continue_post_data'] = '<input type="hidden" name="' . $context['admin-recountposts_token_var'] . '" value="' . $context['admin-recountposts_token'] . '" />
					<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />';
            if (function_exists('apache_reset_timeout')) {
                apache_reset_timeout();
            }
            return;
        }
        // No countable posts? set posts counter to 0
        updateZeroPostMembers();
        // All done, clean up and go back to maintainance
        unset($_SESSION['total_members']);
        redirectexit('action=admin;area=maintain;sa=members;done=recountposts');
    }