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


PHP chat_update_chat_times函数代码示例

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


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

示例1: chat_cron

/**
 * Function to be run periodically according to the moodle cron
 * This function searches for things that need to be done, such
 * as sending out mail, toggling flags etc ...
 *
 * @global object
 * @return bool
 */
function chat_cron()
{
    global $DB;
    chat_update_chat_times();
    chat_delete_old_users();
    /// Delete old messages with a
    /// single SQL query.
    $subselect = "SELECT c.keepdays\n                    FROM {chat} c\n                   WHERE c.id = {chat_messages}.chatid";
    $sql = "DELETE\n              FROM {chat_messages}\n             WHERE ({$subselect}) > 0 AND timestamp < ( " . time() . " -({$subselect}) * 24 * 3600)";
    $DB->execute($sql);
    $sql = "DELETE\n              FROM {chat_messages_current}\n             WHERE timestamp < ( " . time() . " - 8 * 3600)";
    $DB->execute($sql);
    return true;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:22,代码来源:lib.php

示例2: print_error

    if (! $cm = get_coursemodule_from_id('chat', $id)) {
        print_error('invalidcoursemodule');
    }

    if (! $course = $DB->get_record('course', array('id'=>$cm->course))) {
        print_error('coursemisconf');
    }

    chat_update_chat_times($cm->instance);

    if (! $chat = $DB->get_record('chat', array('id'=>$cm->instance))) {
        print_error('invalidid', 'chat');
    }

} else {
    chat_update_chat_times($c);

    if (! $chat = $DB->get_record('chat', array('id'=>$c))) {
        print_error('coursemisconf');
    }
    if (! $course = $DB->get_record('course', array('id'=>$chat->course))) {
        print_error('coursemisconf');
    }
    if (! $cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
        print_error('invalidcoursemodule');
    }
}

require_course_login($course, true, $cm);

$context = context_module::instance($cm->id);
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:view.php

示例3: chat_cron

function chat_cron()
{
    /// Function to be run periodically according to the moodle cron
    /// This function searches for things that need to be done, such
    /// as sending out mail, toggling flags etc ...
    global $CFG;
    chat_update_chat_times();
    chat_delete_old_users();
    /// Delete old messages
    if ($chats = get_records("chat")) {
        foreach ($chats as $chat) {
            if ($chat->keepdays) {
                $timeold = time() - $chat->keepdays * 24 * 3600;
                delete_records_select("chat_messages", "chatid = '{$chat->id}' AND timestamp < '{$timeold}'");
            }
        }
    }
    return true;
}
开发者ID:veritech,项目名称:pare-project,代码行数:19,代码来源:lib.php

示例4: chat_cron

function chat_cron()
{
    /// Function to be run periodically according to the moodle cron
    /// This function searches for things that need to be done, such
    /// as sending out mail, toggling flags etc ...
    global $CFG;
    chat_update_chat_times();
    chat_delete_old_users();
    /// Delete old messages
    $sql = "SELECT m.id \n            FROM {$CFG->prefix}chat_messages m \n            JOIN {$CFG->prefix}chat c\n              ON m.chatid = c.id\n            WHERE c.keepdays != 0 \n                  AND m.timestamp < ( " . time() . " - c.keepdays * 24 * 3600)";
    delete_records_select("chat_messages", "id IN ({$sql})");
    return true;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:13,代码来源:lib.php

示例5: chat_cron

function chat_cron()
{
    /// Function to be run periodically according to the moodle cron
    /// This function searches for things that need to be done, such
    /// as sending out mail, toggling flags etc ...
    global $DB;
    chat_update_chat_times();
    chat_delete_old_users();
    /// Delete old messages with a
    /// single SQL query.
    $subselect = "SELECT c.keepdays\n                    FROM {chat} c\n                   WHERE c.id = {chat_messages}.chatid";
    $sql = "DELETE\n              FROM {chat_messages}\n             WHERE ({$subselect}) > 0 AND timestamp < ( " . time() . " -({$subselect}) * 24 * 3600)";
    $DB->execute($sql);
    $sql = "DELETE\n              FROM {chat_messages_current}\n             WHERE timestamp < ( " . time() . " - 8 * 3600)";
    $DB->execute($sql);
    return true;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:17,代码来源:lib.php


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