Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * this file contains the task to cleanup historic logs.
19
 *
20
 * File         logclean.php
21
 * Encoding     UTF-8
22
 * @copyright   Sebsoft.nl
23
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
namespace tool_usersuspension\task;
27
 
28
use tool_usersuspension\config;
29
 
30
/**
31
 * Description of logclean
32
 *
33
 * @package     tool_usersuspension
34
 *
35
 * @copyright   Sebsoft.nl
36
 * @author      R.J. van Dongen <rogier@sebsoft.nl>
37
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38
 */
39
class logclean extends \core\task\scheduled_task {
40
 
41
    /**
42
     * Return the localised name for this task
43
     *
44
     * @return string task name
45
     */
46
    public function get_name() {
47
        return get_string('task:logclean', 'tool_usersuspension');
48
    }
49
 
50
    /**
51
     * Executes the task
52
     *
53
     * @return void
54
     */
55
    public function execute() {
56
        if (!(bool)config::get('enablecleanlogs')) {
57
            mtrace(get_string('config:cleanlogs:disabled', 'tool_usersuspension'));
58
            return;
59
        }
60
        \tool_usersuspension\util::clean_logs();
61
    }
62
 
63
}