当前位置: 首页>>代码示例>>PHP>>正文


PHP add_task_log函数代码示例

本文整理汇总了PHP中add_task_log函数的典型用法代码示例。如果您正苦于以下问题:PHP add_task_log函数的具体用法?PHP add_task_log怎么用?PHP add_task_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add_task_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: task_hourlycleanup

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_hourlycleanup($task)
{
    global $db, $lang, $plugins;
    $time = array('threads' => TIME_NOW, 'searchlog' => TIME_NOW - 60 * 60 * 24, 'captcha' => TIME_NOW - 60 * 60 * 24, 'question' => TIME_NOW - 60 * 60 * 24);
    if (is_object($plugins)) {
        $args = array('task' => &$task, 'time' => &$time);
        $plugins->run_hooks('task_hourlycleanup', $args);
    }
    require_once MYBB_ROOT . "inc/class_moderation.php";
    $moderation = new Moderation();
    // Delete moved threads with time limits
    $query = $db->simple_select('threads', 'tid', "deletetime != '0' AND deletetime < '" . (int) $time['threads'] . "'");
    while ($tid = $db->fetch_field($query, 'tid')) {
        $moderation->delete_thread($tid);
    }
    // Delete old searches
    $db->delete_query("searchlog", "dateline < '" . (int) $time['searchlog'] . "'");
    // Delete old captcha images
    $cut = TIME_NOW - 60 * 60 * 24 * 7;
    $db->delete_query("captcha", "dateline < '" . (int) $time['captcha'] . "'");
    // Delete old registration questions
    $cut = TIME_NOW - 60 * 60 * 24 * 7;
    $db->delete_query("questionsessions", "dateline < '" . (int) $time['question'] . "'");
    add_task_log($task, $lang->task_hourlycleanup_ran);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:33,代码来源:hourlycleanup.php

示例2: task_userpruning

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_userpruning($task)
{
    global $db, $lang, $mybb, $cache, $plugins;
    if ($mybb->settings['enablepruning'] != 1) {
        return;
    }
    // Are we pruning by posts?
    if ($mybb->settings['enableprunebyposts'] == 1) {
        $in_usergroups = array();
        $users = array();
        $usergroups = $cache->read('usergroups');
        foreach ($usergroups as $gid => $usergroup) {
            // Exclude admin, moderators, super moderators, banned
            if ($usergroup['canmodcp'] == 1 || $usergroup['cancp'] == 1 || $usergroup['issupermod'] == 1 || $usergroup['isbannedgroup'] == 1) {
                continue;
            }
            $in_usergroups[] = $gid;
        }
        // If we're not pruning unactivated users, then remove them from the criteria
        if ($mybb->settings['pruneunactived'] == 0) {
            $key = array_search('5', $in_usergroups);
            unset($in_usergroups[$key]);
        }
        $prunepostcount = (int) $mybb->settings['prunepostcount'];
        $regdate = TIME_NOW - (int) $mybb->settings['dayspruneregistered'] * 24 * 60 * 60;
        $usergroups = $db->escape_string(implode(',', $in_usergroups));
        $query = $db->simple_select('users', 'uid', "regdate<={$regdate} AND postnum<={$prunepostcount} AND usergroup IN({$usergroups})");
        while ($uid = $db->fetch_field($query, 'uid')) {
            $users[$uid] = $uid;
        }
        if ($users && $mybb->settings['prunepostcountall']) {
            $query = $db->simple_select('posts', 'uid, COUNT(pid) as posts', "uid IN ('" . implode("','", $users) . "') AND visible>0", array('group_by' => 'uid'));
            while ($user = $db->fetch_array($query)) {
                if ($user['posts'] >= $prunepostcount) {
                    unset($users[$user['uid']]);
                }
            }
        }
    }
    // Are we pruning unactivated users?
    if ($mybb->settings['pruneunactived'] == 1) {
        $regdate = TIME_NOW - (int) $mybb->settings['dayspruneunactivated'] * 24 * 60 * 60;
        $query = $db->simple_select("users", "uid", "regdate<={$regdate} AND usergroup='5'");
        while ($user = $db->fetch_array($query)) {
            $users[$user['uid']] = $user['uid'];
        }
    }
    if (is_object($plugins)) {
        $args = array('task' => &$task, 'in_usergroups' => &$in_usergroups, 'users' => &$users);
        $plugins->run_hooks('task_userpruning', $args);
    }
    if (!empty($users)) {
        // Set up user handler.
        require_once MYBB_ROOT . 'inc/datahandlers/user.php';
        $userhandler = new UserDataHandler('delete');
        // Delete the prunned users
        $userhandler->delete_user($users, $mybb->settings['prunethreads']);
    }
    add_task_log($task, $lang->task_userpruning_ran);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:68,代码来源:userpruning.php

示例3: task_logcleanup

/**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://mybb.com
 * License: http://mybb.com/about/license
 *
 * $Id: logcleanup.php 5297 2010-12-28 22:01:14Z Tomm $
 */
function task_logcleanup($task)
{
    global $mybb, $db, $lang;
    // Clear out old admin logs
    if ($mybb->config['log_pruning']['admin_logs'] > 0) {
        $cut = TIME_NOW - 60 * 60 * 24 * $mybb->config['log_pruning']['admin_logs'];
        $db->delete_query("adminlog", "dateline<'{$cut}'");
    }
    // Clear out old moderator logs
    if ($mybb->config['log_pruning']['mod_logs'] > 0) {
        $cut = TIME_NOW - 60 * 60 * 24 * $mybb->config['log_pruning']['mod_logs'];
        $db->delete_query("moderatorlog", "dateline<'{$cut}'");
    }
    // Clear out old task logs
    if ($mybb->config['log_pruning']['task_logs'] > 0) {
        $cut = TIME_NOW - 60 * 60 * 24 * $mybb->config['log_pruning']['task_logs'];
        $db->delete_query("tasklog", "dateline<'{$cut}'");
    }
    // Clear out old mail error logs
    if ($mybb->config['log_pruning']['mail_logs'] > 0) {
        $cut = TIME_NOW - 60 * 60 * 24 * $mybb->config['log_pruning']['mail_logs'];
        $db->delete_query("mailerrors", "dateline<'{$cut}'");
    }
    // Clear out old user mail logs
    if ($mybb->config['log_pruning']['user_mail_logs'] > 0) {
        $cut = TIME_NOW - 60 * 60 * 24 * $mybb->config['log_pruning']['user_mail_logs'];
        $db->delete_query("maillogs", "dateline<'{$cut}'");
    }
    // Clear out old promotion logs
    if ($mybb->config['log_pruning']['promotion_logs'] > 0) {
        $cut = TIME_NOW - 60 * 60 * 24 * $mybb->config['log_pruning']['promotion_logs'];
        $db->delete_query("promotionlogs", "dateline<'{$cut}'");
    }
    add_task_log($task, $lang->task_logcleanup_ran);
}
开发者ID:Nidrax,项目名称:ppm-1.6,代码行数:44,代码来源:logcleanup.php

示例4: task_usercleanup

/**
 * MyBB 1.4
 * Copyright © 2008 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybboard.net
 * License: http://www.mybboard.net/about/license
 *
 * $Id: usercleanup.php 4304 2009-01-02 01:11:56Z chris $
 */
function task_usercleanup($task)
{
    global $db, $lang, $cache;
    // Expire any old warnings
    expire_warnings();
    // Expire any post moderation or suspension limits
    $query = $db->simple_select("users", "uid, moderationtime, suspensiontime", "(moderationtime!=0 AND moderationtime<" . TIME_NOW . ") OR (suspensiontime!=0 AND suspensiontime<" . TIME_NOW . ")");
    while ($user = $db->fetch_array($query)) {
        $updated_user = array();
        if ($user['moderationtime'] != 0 && $user['moderationtime'] < TIME_NOW) {
            $updated_user['moderateposts'] = 0;
            $updated_user['moderationtime'] = 0;
        }
        if ($user['suspensiontime'] != 0 && $user['suspensiontime'] < TIME_NOW) {
            $updated_user['suspendposting'] = 0;
            $updated_user['suspensiontime'] = 0;
        }
        $db->update_query("users", $updated_user, "uid='{$user['uid']}'");
    }
    // Expire bans
    $query = $db->simple_select("banned", "*", "lifted!=0 AND lifted<" . TIME_NOW);
    while ($ban = $db->fetch_array($query)) {
        $updated_user = array("usergroup" => $ban['oldgroup'], "additionalgroups" => $ban['oldadditionalgroups'], "displaygroup" => $ban['olddisplaygroup']);
        $db->update_query("users", $updated_user, "uid='{$ban['uid']}'");
        $db->delete_query("banned", "uid='{$ban['uid']}'");
    }
    $cache->update_moderators();
    add_task_log($task, $lang->task_usercleanup_ran);
}
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:38,代码来源:usercleanup.php

示例5: task_dailycleanup

/**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://mybb.com
 * License: http://mybb.com/about/license
 *
 * $Id$
 */
function task_dailycleanup($task)
{
    global $mybb, $db, $cache, $lang;
    require_once MYBB_ROOT . "inc/functions_user.php";
    // Clear out sessions older than 24h
    $cut = TIME_NOW - 60 * 60 * 24;
    $db->delete_query("sessions", "time < '{$cut}'");
    // Delete old read topics
    if ($mybb->settings['threadreadcut'] > 0) {
        $cut = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
        $db->delete_query("threadsread", "dateline < '{$cut}'");
        $db->delete_query("forumsread", "dateline < '{$cut}'");
    }
    // Check PMs moved to trash over a week ago & delete them
    $timecut = TIME_NOW - 60 * 60 * 24 * 7;
    $query = $db->simple_select("privatemessages", "pmid, uid, folder", "deletetime<='{$timecut}' AND folder='4'");
    while ($pm = $db->fetch_array($query)) {
        $user_update[$pm['uid']] = $uid;
        $pm_update[] = $pm['pmid'];
    }
    if (!empty($pm_update)) {
        $db->delete_query("privatemessages", "pmid IN(" . implode(',', $pm_update) . ")");
    }
    if (!empty($user_update)) {
        foreach ($user_update as $uid) {
            update_pm_count($uid);
        }
    }
    $cache->update_most_replied_threads();
    $cache->update_most_viewed_threads();
    $cache->update_birthdays();
    $cache->update_forumsdisplay();
    add_task_log($task, $lang->task_dailycleanup_ran);
}
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:43,代码来源:dailycleanup.php

示例6: task_backupnewpoints

function task_backupnewpoints($task)
{
    global $mybb, $db, $lang, $cache, $plugins;
    $lang->load("newpoints");
    $plugins->run_hooks("newpoints_task_backup");
    backupnewpoints_backupdb();
    add_task_log($task, $lang->newpoints_task_ran);
}
开发者ID:ambsalinas,项目名称:anima,代码行数:8,代码来源:backupnewpoints.php

示例7: task_versioncheck

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_versioncheck($task)
{
    global $cache, $lang, $mybb;
    $current_version = rawurlencode($mybb->version_code);
    $updated_cache = array('last_check' => TIME_NOW);
    // Check for the latest version
    require_once MYBB_ROOT . 'inc/class_xml.php';
    $contents = fetch_remote_file("http://www.mybb.com/version_check.php");
    if (!$contents) {
        add_task_log($task, $lang->task_versioncheck_ran_errors);
        return false;
    }
    $pos = strpos($contents, "<");
    if ($pos > 1) {
        $contents = substr($contents, $pos);
    }
    $pos = strpos(strrev($contents), ">");
    if ($pos > 1) {
        $contents = substr($contents, 0, -1 * ($pos - 1));
    }
    $parser = new XMLParser($contents);
    $tree = $parser->get_tree();
    $latest_code = (int) $tree['mybb']['version_code']['value'];
    $latest_version = "<strong>" . htmlspecialchars_uni($tree['mybb']['latest_version']['value']) . "</strong> (" . $latest_code . ")";
    if ($latest_code > $mybb->version_code) {
        $latest_version = "<span style=\"color: #C00;\">" . $latest_version . "</span>";
        $version_warn = 1;
        $updated_cache['latest_version'] = $latest_version;
        $updated_cache['latest_version_code'] = $latest_code;
    } else {
        $latest_version = "<span style=\"color: green;\">" . $latest_version . "</span>";
    }
    // Check for the latest news
    require_once MYBB_ROOT . "inc/class_feedparser.php";
    $feed_parser = new FeedParser();
    $feed_parser->parse_feed("http://feeds.feedburner.com/MyBBDevelopmentBlog");
    $updated_cache['news'] = array();
    require_once MYBB_ROOT . '/inc/class_parser.php';
    $post_parser = new postParser();
    if ($feed_parser->error == '') {
        foreach ($feed_parser->items as $item) {
            if (isset($updated_cache['news'][2])) {
                break;
            }
            $description = $item['description'];
            $description = $post_parser->parse_message($description, array('allow_html' => true));
            $description = preg_replace('#<img(.*)/>#', '', $description);
            $updated_cache['news'][] = array('title' => htmlspecialchars_uni($item['title']), 'description' => $description, 'link' => htmlspecialchars_uni($item['link']), 'author' => htmlspecialchars_uni($item['author']), 'dateline' => $item['date_timestamp']);
        }
    }
    $cache->update("update_check", $updated_cache);
    add_task_log($task, $lang->task_versioncheck_ran);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:61,代码来源:versioncheck.php

示例8: task_myalerts

function task_myalerts($task)
{
    global $db, $lang;
    if (!isset($lang->myalerts)) {
        $lang->load('myalerts');
    }
    if ($db->delete_query('alerts', 'unread = 0')) {
        add_task_log($task, $lang->myalerts_task_cleanup_ran);
    } else {
        add_task_log($task, $lang->myalerts_task_cleanup_error);
    }
}
开发者ID:harrygg,项目名称:MyAlerts,代码行数:12,代码来源:myalerts.php

示例9: run_task

/**
 * Execute a scheduled task.
 *
 * @param int $tid The task ID. If none specified, the next task due to be ran is executed
 * @return boolean True if successful, false on failure
 */
function run_task($tid = 0)
{
    global $db, $mybb, $cache, $plugins, $task, $lang;
    // Run a specific task
    if ($tid > 0) {
        $query = $db->simple_select("tasks", "*", "tid='{$tid}'");
        $task = $db->fetch_array($query);
    } else {
        $query = $db->simple_select("tasks", "*", "enabled=1 AND nextrun<='" . TIME_NOW . "'", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1));
        $task = $db->fetch_array($query);
    }
    // No task? Return
    if (!$task['tid']) {
        $cache->update_tasks();
        return false;
    }
    // Is this task still running and locked less than 5 minutes ago? Well don't run it now - clearly it isn't broken!
    if ($task['locked'] != 0 && $task['locked'] > TIME_NOW - 300) {
        $cache->update_tasks();
        return false;
    } else {
        $db->update_query("tasks", array("locked" => TIME_NOW), "tid='{$task['tid']}'");
    }
    // The task file does not exist
    if (!file_exists(MYBB_ROOT . "inc/tasks/{$task['file']}.php")) {
        if ($task['logging'] == 1) {
            add_task_log($task, $lang->missing_task);
        }
        // If task file does not exist, disable task and inform the administrator
        $updated_task = array("enabled" => 0, "locked" => 0);
        $db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
        $subject = $lang->sprintf($lang->email_broken_task_subject, $mybb->settings['bbname']);
        $message = $lang->sprintf($lang->email_broken_task, $mybb->settings['bbname'], $mybb->settings['bburl'], $task['title']);
        my_mail($mybb->settings['adminemail'], $subject, $message, $mybb->settings['adminemail']);
        $cache->update_tasks();
        return false;
    } else {
        // Update the nextrun time now, so if the task causes a fatal error, it doesn't get stuck first in the queue
        $nextrun = fetch_next_run($task);
        $db->update_query("tasks", array("nextrun" => $nextrun), "tid='{$task['tid']}'");
        include_once MYBB_ROOT . "inc/tasks/{$task['file']}.php";
        $function = "task_{$task['file']}";
        if (function_exists($function)) {
            $function($task);
        }
    }
    $updated_task = array("lastrun" => TIME_NOW, "locked" => 0);
    $db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
    $cache->update_tasks();
    return true;
}
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:57,代码来源:functions_task.php

示例10: task_checktables

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_checktables($task)
{
    global $db, $mybb, $lang, $plugins;
    // Sorry SQLite, you don't have a decent way of checking if the table is corrupted or not.
    if ($db->type == "sqlite") {
        return;
    }
    @set_time_limit(0);
    $ok = array("The storage engine for the table doesn't support check", "Table is already up to date", "OK");
    $comma = "";
    $tables_list = "";
    $repaired = "";
    $setting_done = false;
    $tables = $db->list_tables($mybb->config['database']['database'], $mybb->config['database']['table_prefix']);
    foreach ($tables as $key => $table) {
        $tables_list .= "{$comma}{$table} ";
        $comma = ",";
    }
    if ($tables_list) {
        $query = $db->query("CHECK TABLE {$tables_list}CHANGED;");
        while ($table = $db->fetch_array($query)) {
            if (!in_array($table['Msg_text'], $ok)) {
                if ($table['Table'] != $mybb->config['database']['database'] . "." . TABLE_PREFIX . "settings" && $setting_done != true) {
                    $boardclosed = $mybb->settings['boardclosed'];
                    $boardclosed_reason = $mybb->settings['boardclosed_reason'];
                    $db->update_query("settings", array('value' => 1), "name='boardclosed'", 1);
                    $db->update_query("settings", array('value' => $db->escape_string($lang->error_database_repair)), "name='boardclosed_reason'", 1);
                    rebuild_settings();
                    $setting_done = true;
                }
                $db->query("REPAIR TABLE {$table['Table']}");
                $repaired[] = $table['Table'];
            }
        }
        if ($table['Table'] != $mybb->config['database']['table_prefix'] . "." . TABLE_PREFIX . "settings" && $setting_done == true) {
            $db->update_query("settings", array('value' => (int) $boardclosed), "name='boardclosed'", 1);
            $db->update_query("settings", array('value' => $db->escape_string($boardclosed_reason)), "name='boardclosed_reason'", 1);
            rebuild_settings();
        }
    }
    if (is_object($plugins)) {
        $plugins->run_hooks('task_checktables', $task);
    }
    if (!empty($repaired)) {
        add_task_log($task, $lang->sprintf($lang->task_checktables_ran_found, implode(', ', $repaired)));
    } else {
        add_task_log($task, $lang->task_checktables_ran);
    }
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:57,代码来源:checktables.php

示例11: task_threadviews

/**
 * MyBB 1.4
 * Copyright © 2008 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybboard.net
 * License: http://www.mybboard.net/about/license
 *
 * $Id: threadviews.php 4304 2009-01-02 01:11:56Z chris $
 */
function task_threadviews($task)
{
    global $mybb, $db, $lang;
    $threadviews = array();
    if ($mybb->settings['delayedthreadviews'] != 1) {
        return;
    }
    // Update thread views
    $query = $db->query("\n\t\tSELECT tid, COUNT(tid) AS views\n\t\tFROM " . TABLE_PREFIX . "threadviews\n\t\tGROUP BY tid\n\t");
    while ($threadview = $db->fetch_array($query)) {
        $db->write_query("UPDATE " . TABLE_PREFIX . "threads SET views=views+{$threadview['views']} WHERE tid='{$threadview['tid']}' LIMIT 1");
    }
    $db->write_query("TRUNCATE TABLE " . TABLE_PREFIX . "threadviews");
    add_task_log($task, $lang->task_threadviews_ran);
}
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:24,代码来源:threadviews.php

示例12: task_hourlycleanup

/**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://mybb.com
 * License: http://mybb.com/about/license
 *
 * $Id$
 */
function task_hourlycleanup($task)
{
    global $db, $lang;
    $threads = array();
    $posts = array();
    // Delete moved threads with time limits
    $db->delete_query("threads", "deletetime != '0' AND deletetime < '" . TIME_NOW . "'");
    // Delete old searches
    $cut = TIME_NOW - 60 * 60 * 24;
    $db->delete_query("searchlog", "dateline < '{$cut}'");
    // Delete old captcha images
    $cut = TIME_NOW - 60 * 60 * 24;
    $db->delete_query("captcha", "dateline < '{$cut}'");
    add_task_log($task, $lang->task_hourlycleanup_ran);
}
开发者ID:slothly,项目名称:mybb,代码行数:24,代码来源:hourlycleanup.php

示例13: task_dailycleanup

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_dailycleanup($task)
{
    global $mybb, $db, $cache, $lang, $plugins;
    require_once MYBB_ROOT . "inc/functions_user.php";
    $time = array('sessionstime' => TIME_NOW - 60 * 60 * 24, 'threadreadcut' => TIME_NOW - (int) $mybb->settings['threadreadcut'] * 60 * 60 * 24, 'privatemessages' => TIME_NOW - 60 * 60 * 24 * 7, 'deleteinvite' => TIME_NOW - (int) $mybb->settings['deleteinvites'] * 60 * 60 * 24, 'stoppmtracking' => TIME_NOW - 60 * 60 * 24 * 180);
    if (is_object($plugins)) {
        $args = array('task' => &$task, 'time' => &$time);
        $plugins->run_hooks('task_dailycleanup_start', $args);
    }
    // Clear out sessions older than 24h
    $db->delete_query("sessions", "time < '" . (int) $time['sessionstime'] . "'");
    // Delete old read topics
    if ($mybb->settings['threadreadcut'] > 0) {
        $db->delete_query("threadsread", "dateline < '" . (int) $time['threadreadcut'] . "'");
        $db->delete_query("forumsread", "dateline < '" . (int) $time['threadreadcut'] . "'");
    }
    // Check PMs moved to trash over a week ago & delete them
    $query = $db->simple_select("privatemessages", "pmid, uid, folder", "deletetime<='" . (int) $time['privatemessages'] . "' AND folder='4'");
    while ($pm = $db->fetch_array($query)) {
        $user_update[$pm['uid']] = 1;
        $pm_update[] = $pm['pmid'];
    }
    // Delete old group invites
    if ($mybb->settings['deleteinvites'] > 0) {
        $db->delete_query("joinrequests", "dateline < '" . (int) $time['deleteinvite'] . "' AND invite='1'");
    }
    // Stop tracking read PMs after 6 months
    $sql_array = array("receipt" => 0);
    $db->update_query("privatemessages", $sql_array, "receipt='2' AND folder!='3' AND status!='0' AND readtime < '" . (int) $time['stoppmtracking'] . "'");
    if (is_object($plugins)) {
        $args = array('user_update' => &$user_update, 'pm_update' => &$pm_update);
        $plugins->run_hooks('task_dailycleanup_end', $args);
    }
    if (!empty($pm_update)) {
        $db->delete_query("privatemessages", "pmid IN(" . implode(',', $pm_update) . ")");
    }
    if (!empty($user_update)) {
        foreach ($user_update as $uid) {
            update_pm_count($uid);
        }
    }
    $cache->update_most_replied_threads();
    $cache->update_most_viewed_threads();
    $cache->update_birthdays();
    $cache->update_forumsdisplay();
    add_task_log($task, $lang->task_dailycleanup_ran);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:55,代码来源:dailycleanup.php

示例14: task_threadviews

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_threadviews($task)
{
    global $mybb, $db, $lang, $plugins;
    if ($mybb->settings['delayedthreadviews'] != 1) {
        return;
    }
    // Update thread views
    $query = $db->simple_select("threadviews", "tid, COUNT(tid) AS views", "", array('group_by' => 'tid'));
    while ($threadview = $db->fetch_array($query)) {
        $db->update_query("threads", array('views' => "views+{$threadview['views']}"), "tid='{$threadview['tid']}'", 1, true);
    }
    $db->write_query("TRUNCATE TABLE " . TABLE_PREFIX . "threadviews");
    if (is_object($plugins)) {
        $plugins->run_hooks('task_threadviews', $task);
    }
    add_task_log($task, $lang->task_threadviews_ran);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:25,代码来源:threadviews.php

示例15: task_usercleanup

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_usercleanup($task)
{
    global $db, $lang, $cache, $plugins;
    // Expire any old warnings
    require_once MYBB_ROOT . 'inc/datahandlers/warnings.php';
    $warningshandler = new WarningsHandler('update');
    $warningshandler->expire_warnings();
    // Expire any post moderation or suspension limits
    $query = $db->simple_select("users", "uid, moderationtime, suspensiontime", "(moderationtime!=0 AND moderationtime<" . TIME_NOW . ") OR (suspensiontime!=0 AND suspensiontime<" . TIME_NOW . ")");
    while ($user = $db->fetch_array($query)) {
        $updated_user = array();
        if ($user['moderationtime'] != 0 && $user['moderationtime'] < TIME_NOW) {
            $updated_user['moderateposts'] = 0;
            $updated_user['moderationtime'] = 0;
        }
        if ($user['suspensiontime'] != 0 && $user['suspensiontime'] < TIME_NOW) {
            $updated_user['suspendposting'] = 0;
            $updated_user['suspensiontime'] = 0;
        }
        $db->update_query("users", $updated_user, "uid='{$user['uid']}'");
    }
    // Expire any suspended signatures
    $query = $db->simple_select("users", "uid, suspendsigtime", "suspendsignature != 0 AND suspendsigtime < '" . TIME_NOW . "'");
    while ($user = $db->fetch_array($query)) {
        if ($user['suspendsigtime'] != 0 && $user['suspendsigtime'] < TIME_NOW) {
            $updated_user = array("suspendsignature" => 0, "suspendsigtime" => 0);
            $db->update_query("users", $updated_user, "uid='" . $user['uid'] . "'");
        }
    }
    // Expire bans
    $query = $db->simple_select("banned", "*", "lifted!=0 AND lifted<" . TIME_NOW);
    while ($ban = $db->fetch_array($query)) {
        $updated_user = array("usergroup" => $ban['oldgroup'], "additionalgroups" => $ban['oldadditionalgroups'], "displaygroup" => $ban['olddisplaygroup']);
        $db->update_query("users", $updated_user, "uid='{$ban['uid']}'");
        $db->delete_query("banned", "uid='{$ban['uid']}'");
    }
    $cache->update_moderators();
    if (is_object($plugins)) {
        $plugins->run_hooks('task_usercleanup', $task);
    }
    add_task_log($task, $lang->task_usercleanup_ran);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:50,代码来源:usercleanup.php


注:本文中的add_task_log函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。