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


PHP stats_cron_monthly函数代码示例

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


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

示例1: execute

 /**
  * Do the job.
  * Throw exceptions on errors (the job will be retried).
  */
 public function execute()
 {
     global $CFG;
     $timenow = time();
     // Run stats as at the end because they are known to take very long time on large sites.
     if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
         require_once $CFG->dirroot . '/lib/statslib.php';
         // Check we're not before our runtime.
         $timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour * 60 * 60 + $CFG->statsruntimestartminute * 60;
         if ($timenow > $timetocheck) {
             // Process configured number of days as max (defaulting to 31).
             $maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
             if (stats_cron_daily($maxdays)) {
                 if (stats_cron_weekly()) {
                     if (stats_cron_monthly()) {
                         stats_clean_old();
                     }
                 }
             }
             \core_php_time_limit::raise();
         } else {
             mtrace('Next stats run after:' . userdate($timetocheck));
         }
     }
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:29,代码来源:stats_cron_task.php

示例2: execute

 /**
  * Do the job.
  * Throw exceptions on errors (the job will be retried).
  */
 public function execute()
 {
     global $CFG;
     // Run stats as at the end because they are known to take very long time on large sites.
     if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
         require_once $CFG->dirroot . '/lib/statslib.php';
         // Process configured number of days as max (defaulting to 31).
         $maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
         if (stats_cron_daily($maxdays)) {
             if (stats_cron_weekly()) {
                 if (stats_cron_monthly()) {
                     stats_clean_old();
                 }
             }
         }
         \core_php_time_limit::raise();
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:22,代码来源:stats_cron_task.php

示例3: cron_run


//.........这里部分代码省略.........
    if (!empty($CFG->enableblogs) && $CFG->useblogassociations) {
        require_once $CFG->dirroot . '/blog/lib.php';
        // delete entries whose contextids no longer exists
        mtrace("Deleting blog associations linked to non-existent contexts...", '');
        cron_trace_time_and_memory();
        $DB->delete_records_select('blog_association', 'contextid NOT IN (SELECT id FROM {context})');
        mtrace('done.');
    }
    // Run question bank clean-up.
    mtrace("Starting the question bank cron...", '');
    cron_trace_time_and_memory();
    require_once $CFG->libdir . '/questionlib.php';
    question_bank::cron();
    mtrace('done.');
    //Run registration updated cron
    mtrace(get_string('siteupdatesstart', 'hub'));
    cron_trace_time_and_memory();
    require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php';
    $registrationmanager = new registration_manager();
    $registrationmanager->cron();
    mtrace(get_string('siteupdatesend', 'hub'));
    // If enabled, fetch information about available updates and eventually notify site admins
    if (empty($CFG->disableupdatenotifications)) {
        $updateschecker = \core\update\checker::instance();
        $updateschecker->cron();
    }
    //cleanup old session linked tokens
    //deletes the session linked tokens that are over a day old.
    mtrace("Deleting session linked tokens more than one day old...", '');
    cron_trace_time_and_memory();
    $DB->delete_records_select('external_tokens', 'lastaccess < :onedayago AND tokentype = :tokentype', array('onedayago' => time() - DAYSECS, 'tokentype' => EXTERNAL_TOKEN_EMBEDDED));
    mtrace('done.');
    // all other plugins
    cron_execute_plugin_type('message', 'message plugins');
    cron_execute_plugin_type('filter', 'filters');
    cron_execute_plugin_type('editor', 'editors');
    cron_execute_plugin_type('format', 'course formats');
    cron_execute_plugin_type('profilefield', 'profile fields');
    cron_execute_plugin_type('webservice', 'webservices');
    cron_execute_plugin_type('repository', 'repository plugins');
    cron_execute_plugin_type('qbehaviour', 'question behaviours');
    cron_execute_plugin_type('qformat', 'question import/export formats');
    cron_execute_plugin_type('qtype', 'question types');
    cron_execute_plugin_type('plagiarism', 'plagiarism plugins');
    cron_execute_plugin_type('theme', 'themes');
    cron_execute_plugin_type('tool', 'admin tools');
    // and finally run any local cronjobs, if any
    if ($locals = core_component::get_plugin_list('local')) {
        mtrace('Processing customized cron scripts ...', '');
        // new cron functions in lib.php first
        cron_execute_plugin_type('local');
        // legacy cron files are executed directly
        foreach ($locals as $local => $localdir) {
            if (file_exists("{$localdir}/cron.php")) {
                include "{$localdir}/cron.php";
            }
        }
        mtrace('done.');
    }
    mtrace('Running cache cron routines');
    cache_helper::cron();
    mtrace('done.');
    // Run automated backups if required - these may take a long time to execute
    require_once $CFG->dirroot . '/backup/util/includes/backup_includes.php';
    require_once $CFG->dirroot . '/backup/util/helper/backup_cron_helper.class.php';
    backup_cron_automated_helper::run_automated_backup();
    // Run stats as at the end because they are known to take very long time on large sites
    if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
        require_once $CFG->dirroot . '/lib/statslib.php';
        // check we're not before our runtime
        $timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour * 60 * 60 + $CFG->statsruntimestartminute * 60;
        if (time() > $timetocheck) {
            // process configured number of days as max (defaulting to 31)
            $maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
            if (stats_cron_daily($maxdays)) {
                if (stats_cron_weekly()) {
                    if (stats_cron_monthly()) {
                        stats_clean_old();
                    }
                }
            }
            @set_time_limit(0);
        } else {
            mtrace('Next stats run after:' . userdate($timetocheck));
        }
    }
    // Run badges review cron.
    mtrace("Starting badges cron...");
    require_once $CFG->dirroot . '/badges/cron.php';
    badge_cron();
    mtrace('done.');
    // cleanup file trash - not very important
    $fs = get_file_storage();
    $fs->cron();
    mtrace("Cron script completed correctly");
    gc_collect_cycles();
    mtrace('Cron completed at ' . date('H:i:s') . '. Memory used ' . display_size(memory_get_usage()) . '.');
    $difftime = microtime_diff($starttime, microtime());
    mtrace("Execution took " . $difftime . " seconds");
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:101,代码来源:cronlib.php

示例4: cron_run


//.........这里部分代码省略.........
    $auths = get_enabled_auth_plugins();
    mtrace("Running auth crons if required...");
    foreach ($auths as $auth) {
        $authplugin = get_auth_plugin($auth);
        if (method_exists($authplugin, 'cron')) {
            mtrace("Running cron for auth/{$auth}...");
            $authplugin->cron();
            if (!empty($authplugin->log)) {
                mtrace($authplugin->log);
            }
        }
        unset($authplugin);
    }
    mtrace("Running enrol crons if required...");
    $enrols = enrol_get_plugins(true);
    foreach ($enrols as $ename => $enrol) {
        // do this for all plugins, disabled plugins might want to cleanup stuff such as roles
        if (!$enrol->is_cron_required()) {
            continue;
        }
        mtrace("Running cron for enrol_{$ename}...");
        $enrol->cron();
        $enrol->set_config('lastcron', time());
    }
    if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
        require_once $CFG->dirroot . '/lib/statslib.php';
        // check we're not before our runtime
        $timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour * 60 * 60 + $CFG->statsruntimestartminute * 60;
        if (time() > $timetocheck) {
            // process configured number of days as max (defaulting to 31)
            $maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
            if (stats_cron_daily($maxdays)) {
                if (stats_cron_weekly()) {
                    if (stats_cron_monthly()) {
                        stats_clean_old();
                    }
                }
            }
            @set_time_limit(0);
        } else {
            mtrace('Next stats run after:' . userdate($timetocheck));
        }
    }
    // run gradebook import/export/report cron
    if ($gradeimports = get_plugin_list('gradeimport')) {
        foreach ($gradeimports as $gradeimport => $plugindir) {
            if (file_exists($plugindir . '/lib.php')) {
                require_once $plugindir . '/lib.php';
                $cron_function = 'grade_import_' . $gradeimport . '_cron';
                if (function_exists($cron_function)) {
                    mtrace("Processing gradebook import function {$cron_function} ...", '');
                    $cron_function();
                }
            }
        }
    }
    if ($gradeexports = get_plugin_list('gradeexport')) {
        foreach ($gradeexports as $gradeexport => $plugindir) {
            if (file_exists($plugindir . '/lib.php')) {
                require_once $plugindir . '/lib.php';
                $cron_function = 'grade_export_' . $gradeexport . '_cron';
                if (function_exists($cron_function)) {
                    mtrace("Processing gradebook export function {$cron_function} ...", '');
                    $cron_function();
                }
            }
开发者ID:vuchannguyen,项目名称:web,代码行数:67,代码来源:cronlib.php

示例5: mtrace

    }
    if (!empty($enrol->log)) {
        mtrace($enrol->log);
    }
    unset($enrol);
}
if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
    require_once $CFG->dirroot . '/lib/statslib.php';
    // check we're not before our runtime
    $timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour * 60 * 60 + $CFG->statsruntimestartminute * 60;
    if (time() > $timetocheck) {
        // process configured number of days as max (defaulting to 31)
        $maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
        if (stats_cron_daily($maxdays)) {
            if (stats_cron_weekly()) {
                if (stats_cron_monthly()) {
                    stats_clean_old();
                }
            }
        }
        @set_time_limit(0);
    } else {
        mtrace('Next stats run after:' . userdate($timetocheck));
    }
}
// run gradebook import/export/report cron
if ($gradeimports = get_list_of_plugins('grade/import')) {
    foreach ($gradeimports as $gradeimport) {
        if (file_exists($CFG->dirroot . '/grade/import/' . $gradeimport . '/lib.php')) {
            require_once $CFG->dirroot . '/grade/import/' . $gradeimport . '/lib.php';
            $cron_function = 'grade_import_' . $gradeimport . '_cron';
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:31,代码来源:cron.php


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