本文整理汇总了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));
}
}
}
示例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();
}
}
示例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");
}
示例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();
}
}
示例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';