mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-38196 Backup/restore: Display log if non-empty
When doing a backup or restore operation with the normal user interface, if there is anything in the backup/restore log, it will now be displayed at the end of the process below the Continue button. If you have developer debugging enabled, it sets the display level to LOG_DEBUG and there will always be content in the log. Otherwise, it uses LOG_INFO which generally means the log is empty, and nothing displays (no visible change for users).
This commit is contained in:
parent
56cc9b387e
commit
77b3d9dfdf
15 changed files with 220 additions and 73 deletions
46
backup/util/loggers/core_backup_html_logger.class.php
Normal file
46
backup/util/loggers/core_backup_html_logger.class.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Logger that stores HTML log data in memory, ready for later display.
|
||||
*
|
||||
* @package core_backup
|
||||
* @copyright 2013 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_backup_html_logger extends base_logger {
|
||||
/**
|
||||
* @var string HTML output
|
||||
*/
|
||||
protected $html = '';
|
||||
|
||||
protected function action($message, $level, $options = null) {
|
||||
$prefix = $this->get_prefix($level, $options);
|
||||
$depth = isset($options['depth']) ? $options['depth'] : 0;
|
||||
$this->html .= $prefix . str_repeat(' ', $depth) .
|
||||
s($message) . '<br/>' . PHP_EOL;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full HTML content of the log.
|
||||
*
|
||||
* @return string HTML content of log
|
||||
*/
|
||||
public function get_html() {
|
||||
return $this->html;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue