From 33d059072ac4645572b20ca4f66d72fed15dba0c Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Mon, 2 May 2022 14:03:12 +0000 Subject: [PATCH] fix sql error when diffing mvv entities and adjust cache location, fixes #999 Closes #999 --- app/controllers/module/module.php | 6 +++++- app/controllers/shared/log_event.php | 2 +- app/views/module/module/diff.php | 12 ++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/controllers/module/module.php b/app/controllers/module/module.php index b05f09701e6..449254a6f5c 100644 --- a/app/controllers/module/module.php +++ b/app/controllers/module/module.php @@ -1118,6 +1118,9 @@ class Module_ModuleController extends MVVController $type_old = 2; } + $diff_config = new Caxy\HtmlDiff\HtmlDiffConfig(); + $diff_config->setPurifierCacheLocation($GLOBALS['TMP_PATH']); + PageLayout::setTitle(_('Vergleichsansicht')); PageLayout::addStylesheet('print.css'); $factory = $this->get_template_factory(); @@ -1128,7 +1131,8 @@ class Module_ModuleController extends MVVController 'old_module' => $old_module, 'type_new' => $type_new, 'type_old' => $type_old, - 'plugin' => $this->plugin + 'plugin' => $this->plugin, + 'diff_config' => $diff_config, ]); $this->render_text($template->render()); diff --git a/app/controllers/shared/log_event.php b/app/controllers/shared/log_event.php index e88241f8e0d..0355e45d789 100644 --- a/app/controllers/shared/log_event.php +++ b/app/controllers/shared/log_event.php @@ -127,7 +127,7 @@ class Shared_LogEventController extends MVVController LEFT JOIN `log_actions` ON `log_events`.`action_id` = `log_actions`.`action_id` WHERE `info` = ? " . $search_action . " - ORDER BY `mkdate` DESC"); + ORDER BY `log_events`.`mkdate` DESC"); $statement->execute([$mvv_field]); $res = $statement->fetchOne(); if ($res) { diff --git a/app/views/module/module/diff.php b/app/views/module/module/diff.php index 0aaae62bb2f..923923d5510 100644 --- a/app/views/module/module/diff.php +++ b/app/views/module/module/diff.php @@ -66,7 +66,7 @@ <?php $old = $this->render_partial('shared/modul/_modul', ['modul' => $old_module]); $new = $this->render_partial('shared/modul/_modul', ['modul' => $new_module]); - $diff = new Caxy\HtmlDiff\HtmlDiff($old, $new); + $diff = Caxy\HtmlDiff\HtmlDiff::create($old, $new, $diff_config); $diff->build(); echo $diff->getDifference(); ?> @@ -77,19 +77,19 @@ <?php $old = $this->render_partial('shared/modul/_modullvs', ['modul' => $old_module]); $new = $this->render_partial('shared/modul/_modullvs', ['modul' => $new_module]); - $diff = new Caxy\HtmlDiff\HtmlDiff($old, $new); + $diff = Caxy\HtmlDiff\HtmlDiff::create($old, $new, $diff_config); $diff->build(); echo $diff->getDifference(); $old = $this->render_partial('shared/modul/_pruefungen', ['modul' => $old_module]); $new = $this->render_partial('shared/modul/_pruefungen', ['modul' => $new_module]); - $diff = new Caxy\HtmlDiff\HtmlDiff($old, $new); + $diff = Caxy\HtmlDiff\HtmlDiff::create($old, $new, $diff_config); $diff->build(); echo $diff->getDifference(); $old = $this->render_partial('shared/modul/_regularien', ['modul' => $old_module]); $new = $this->render_partial('shared/modul/_regularien', ['modul' => $new_module]); - $diff = new Caxy\HtmlDiff\HtmlDiff($old, $new); + $diff = Caxy\HtmlDiff\HtmlDiff::create($old, $new, $diff_config); $diff->build(); echo $diff->getDifference(); ?> @@ -119,7 +119,7 @@ <? $old = $this->render_partial('shared/modul/_modullv', ['modul' => $old_module]); $new = $this->render_partial('shared/modul/_modullv', ['modul' => $new_module]); - $diff = new Caxy\HtmlDiff\HtmlDiff($old, $new); + $diff = Caxy\HtmlDiff\HtmlDiff::create($old, $new, $diff_config); $diff->build(); echo $diff->getDifference(); ?> @@ -148,7 +148,7 @@ <?php $old = $this->render_partial('shared/modul/_modul_ohne_lv', ['modul' => $old_module]); $new = $this->render_partial('shared/modul/_modul_ohne_lv', ['modul' => $new_module]); - $diff = new Caxy\HtmlDiff\HtmlDiff($old, $new); + $diff = Caxy\HtmlDiff\HtmlDiff::create($old, $new, $diff_config); $diff->build(); echo $diff->getDifference(); ?> -- GitLab