Commit 9b5aab02 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add a line in the logs for each plugin installed


Reduce log noise from html filter & mime type messages

Change-Id: I58c7abd79b9db737cff95f8eeb10c36d691d8860
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 00198eae
......@@ -62,6 +62,7 @@ if ($install) {
catch (SQLException $e) {
json_reply('local', array('error' => true, 'key' => $name, 'errormessage' => $e->getMessage()));
}
log_info('- ' . $data['key']);
if ($name == 'localpostinst') {
// Update local version
$config = new StdClass;
......@@ -71,6 +72,7 @@ if ($install) {
// Installation is finished
set_config('installed', true);
log_info('Installation complete.');
$USER->login('admin', 'mahara');
}
}
......@@ -92,6 +94,10 @@ if (!empty($upgrade)) {
$funname($upgrade);
if (isset($upgrade->install)) {
$data['install'] = $upgrade->install;
log_info('- ' . str_pad($data['key'], 30, ' ') . ' ' . $data['newversion']);
}
else {
log_info('Upgraded ' . $data['key'] . ' to ' . $data['newversion']);
}
$data['error'] = false;
$data['feedback'] = $SESSION->render_messages();
......
......@@ -48,6 +48,7 @@ $upgrades = check_upgrades();
if (!empty($upgrades['core']->install)) {
define('TITLE', get_string('installation', 'admin'));
$smarty->assign('upgradeheading', get_string('performinginstallation', 'admin'));
log_info('Starting Mahara installation...');
}
else {
define('TITLE', get_string('upgrades', 'admin'));
......
......@@ -166,13 +166,14 @@ class PluginArtefactFile extends PluginArtefact {
function resync_filetype_list() {
require_once('xmlize.php');
db_begin();
log_info('Beginning resync of filetype list');
$currentlist = get_records_assoc('artefact_file_mime_types');
$newlist = xmlize(file_get_contents(get_config('docroot') . 'artefact/file/filetypes.xml'));
$filetypes = $newlist['filetypes']['#']['filetype'];
$newtypes = array();
$count = array('added' => 0, 'updated' => 0, 'removed' => 0);
// Step one: if a mimetype is in the new list that is not in the current
// list, add it to the current list.
foreach ($filetypes as $filetype) {
......@@ -180,12 +181,12 @@ class PluginArtefactFile extends PluginArtefact {
foreach ($filetype['#']['mimetypes'][0]['#']['mimetype'] as $type) {
$mimetype = $type['#'];
if (!isset($currentlist[$mimetype])) {
log_debug('Adding mimetype: ' . $mimetype . ' (' . $description . ')');
execute_sql("INSERT INTO {artefact_file_mime_types} (mimetype, description) VALUES (?,?)", array($mimetype, $description));
$count['added']++;
}
else if ($currentlist[$mimetype]->description != $description) {
log_debug('Updating mimetype: ' . $mimetype . ' (' . $description . ')');
execute_sql("UPDATE {artefact_file_mime_types} SET description = ? WHERE mimetype = ?", array($description, $mimetype));
$count['updated']++;
}
$newtypes[$mimetype] = true;
$currentlist[$mimetype] = (object) array(
......@@ -199,12 +200,19 @@ class PluginArtefactFile extends PluginArtefact {
// new list, remove it from the current list.
foreach ($currentlist as $mimetype => $type) {
if (!isset($newtypes[$mimetype])) {
log_debug('Removing mimetype: ' . $mimetype);
delete_records('artefact_file_mime_types', 'mimetype', $mimetype);
$count['removed']++;
}
}
db_commit();
$changes = array();
foreach (array_filter($count) as $k => $v) {
$changes[] = "$v $k";
}
if ($changes) {
log_info('Updated filetype list: ' . join(', ', $changes) . '.');
}
}
public static function get_mimetypes_from_description($description=null) {
......
......@@ -1038,7 +1038,6 @@ function install_view_column_widths() {
*/
function reload_html_filters() {
require_once('xmlize.php');
log_info('Reading HTML filters');
$newlist = xmlize(file_get_contents(get_config('libroot') . 'htmlpurifiercustom/filters.xml'));
$filters = $newlist['filters']['#']['filter'];
......@@ -1047,9 +1046,9 @@ function reload_html_filters() {
'site' => $f['#']['site'][0]['#'],
'file' => $f['#']['filename'][0]['#']
);
log_info('- ' . $f->file);
}
set_config('filters', serialize($filters));
log_info('Enabled ' . count($filters) . ' HTML filters.');
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment