source: moodle/trunk/fuentes/admin/cli/cron.php @ 136

Last change on this file since 136 was 136, checked in by mabarracus, 4 years ago

Ported code to xenial

File size: 1.8 KB
Line 
1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * CLI cron
20 *
21 * This script looks through all the module directories for cron.php files
22 * and runs them.  These files can contain cleanup functions, email functions
23 * or anything that needs to be run on a regular basis.
24 *
25 * @package    core
26 * @subpackage cli
27 * @copyright  2009 Petr Skoda (http://skodak.org)
28 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29 */
30
31define('CLI_SCRIPT', true);
32
33require(dirname(dirname(dirname(__FILE__))).'/config.php');
34require_once($CFG->libdir.'/clilib.php');      // cli only functions
35require_once($CFG->libdir.'/cronlib.php');
36
37// now get cli options
38list($options, $unrecognized) = cli_get_params(array('help'=>false),
39                                               array('h'=>'help'));
40
41if ($unrecognized) {
42    $unrecognized = implode("\n  ", $unrecognized);
43    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
44}
45
46if ($options['help']) {
47    $help =
48"Execute periodic cron actions.
49
50Options:
51-h, --help            Print out this help
52
53Example:
54\$sudo -u www-data /usr/bin/php admin/cli/cron.php
55";
56
57    echo $help;
58    die;
59}
60
61cron_run();
Note: See TracBrowser for help on using the repository browser.