Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]
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 * Task log. 19 * 20 * @package admin 21 * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 require_once(__DIR__ . '/../config.php'); 26 require_once("{$CFG->libdir}/adminlib.php"); 27 28 use core_admin\reportbuilder\local\systemreports\task_logs; 29 use core_reportbuilder\system_report_factory; 30 31 $PAGE->set_url(new \moodle_url('/admin/tasklogs.php')); 32 $PAGE->set_context(context_system::instance()); 33 $PAGE->set_pagelayout('admin'); 34 $strheading = get_string('tasklogs', 'admin'); 35 $PAGE->set_title($strheading); 36 $PAGE->set_heading($strheading); 37 38 admin_externalpage_setup('tasklogs'); 39 40 $logid = optional_param('logid', null, PARAM_INT); 41 $download = optional_param('download', false, PARAM_BOOL); 42 $filter = optional_param('filter', null, PARAM_TEXT); 43 44 if (null !== $logid) { 45 // Raise memory limit in case the log is large. 46 raise_memory_limit(MEMORY_HUGE); 47 $log = $DB->get_record('task_log', ['id' => $logid], '*', MUST_EXIST); 48 49 if ($download) { 50 $filename = str_replace('\\', '_', $log->classname) . "-{$log->id}.log"; 51 header("Content-Disposition: attachment; filename=\"{$filename}\""); 52 } 53 54 readstring_accel($log->output, 'text/plain'); 55 exit; 56 } 57 58 echo $OUTPUT->header(); 59 $report = system_report_factory::create(task_logs::class, context_system::instance()); 60 61 if (!empty($filter)) { 62 $report->set_filter_values([ 63 'task_log:name_values' => trim($filter, '\\'), 64 ]); 65 } 66 67 echo $report->output(); 68 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body