diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2025-03-04 07:51:32 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-03-04 07:51:32 +0000 |
| commit | 53b6639939c9e5de034284655bdc50782dbc80f0 (patch) | |
| tree | 2e5b3b3e39bea61b43e090bb1fab6d4778bc27a5 | |
| parent | fbd1b2cf0036300792f6535ae9aa5a44a028f34c (diff) | |
Resolve "Timeout bei großen Blubber Threads"
Closes #5313
Merge request studip/studip!4001
| -rw-r--r-- | db/migrations/5.3.29_add_index_blubber_comments_mkdate.php | 20 | ||||
| -rw-r--r-- | lib/models/BlubberThread.php | 31 | ||||
| -rw-r--r-- | templates/blubber/course_context.php | 20 |
3 files changed, 22 insertions, 49 deletions
diff --git a/db/migrations/5.3.29_add_index_blubber_comments_mkdate.php b/db/migrations/5.3.29_add_index_blubber_comments_mkdate.php new file mode 100644 index 0000000..1d7ed7a --- /dev/null +++ b/db/migrations/5.3.29_add_index_blubber_comments_mkdate.php @@ -0,0 +1,20 @@ +<?php + +class AddIndexBlubberCommentsMkdate extends Migration +{ + + public function description() + { + return 'Adds index for mkdate to blubber_comments'; + } + + public function up() + { + DBManager::get()->exec("ALTER TABLE `blubber_comments` ADD INDEX mkdate (`mkdate`)"); + } + + public function down() + { + DBManager::get()->exec("ALTER TABLE `blubber_comments` DROP INDEX (`mkdate`)"); + } +} diff --git a/lib/models/BlubberThread.php b/lib/models/BlubberThread.php index 4c3b585..17b3c95 100644 --- a/lib/models/BlubberThread.php +++ b/lib/models/BlubberThread.php @@ -464,41 +464,14 @@ class BlubberThread extends SimpleORMap implements PrivacyObject public function getContextTemplate() { if ($this['context_type'] === 'course') { - $course = Course::find($this['context_id']); - $icons = []; - $schedule_active = false; - foreach ($course->tools as $tool) { - if ($module = $tool->getStudipModule()) { - $last_visit = object_get_visit($this['context_id'], $module->getPluginId()); - $nav = $module->getIconNavigation($this['context_id'], $last_visit, $GLOBALS['user']->id); - if ( - isset($nav) - && $nav->isVisible(true) - && $module->getTabNavigation($this['context_id']) - && $GLOBALS['perm']->have_studip_perm($tool->getVisibilityPermission(), $this['context_id']) - ) { - $icons[] = $nav; - } - if ($module instanceof CoreSchedule) { - $schedule_active = true; - } - } - } - - $nextdate = false; - if ($schedule_active) { - $nextdate = CourseDate::findOneBySQL("range_id = ? AND `date` >= UNIX_TIMESTAMP() ORDER BY `date` ASC", [$this['context_id']]); - } - $teachers = CourseMember::findBySQL("Seminar_id = ? AND status = 'dozent' ORDER BY position ASC", [$this['context_id']]); $tutors = CourseMember::findBySQL("Seminar_id = ? AND status = 'tutor' ORDER BY position ASC", [$this['context_id']]); $students_count = CourseMember::countBySQL("Seminar_id = ? AND status IN ('autor', 'user') ORDER BY position ASC", [$this['context_id']]); $template = $GLOBALS['template_factory']->open('blubber/course_context'); $template->thread = $this; - $template->course = $course; - $template->icons = $icons; - $template->nextdate = $nextdate; + $template->course = Course::find($this['context_id']); + $template->teachers = $teachers; $template->tutors = $tutors; $template->students_count = $students_count; diff --git a/templates/blubber/course_context.php b/templates/blubber/course_context.php index 0d6d2af..583a959 100644 --- a/templates/blubber/course_context.php +++ b/templates/blubber/course_context.php @@ -4,28 +4,8 @@ <a href="<?= URLHelper::getLink("dispatch.php/course/go", ['to' => $course->getId()]) ?>"> <?= htmlReady($course->name) ?> </a> - <div class="icons"> - <ul class="my-courses-navigation"> - <? foreach ($icons as $icon) : ?> - <li class="my-courses-navigation-item <? if ($icon->getImage()->signalsAttention()) echo 'my-courses-navigation-important'; ?>"> - <a href="<?= URLHelper::getLink("dispatch.php/course/go", ['to' => $course->getId(), 'redirect_to' => $icon->getURL()]) ?>"<?= $icon->getTitle() ? ' title="'.htmlReady($icon->getTitle()).'"' : "" ?>> - <?= $icon->getImage() ?> - </a> - </li> - <? endforeach ?> - </ul> - </div> </div> </div> - <? if ($nextdate) : ?> - <div> - <h4><?= _('Nächster Termin') ?></h4> - <a href="<?= URLHelper::getLink("dispatch.php/course/dates/details/".$nextdate->getId(), ['cid' => $course->id]) ?>" data-dialog="size=auto"> - <?= Icon::create('date')->asImg(Icon::SIZE_INLINE, ['class' => 'text-bottom']) ?> - <?= htmlReady($nextdate->getFullName()) ?> - </a> - </div> - <? endif ?> <div> <? $sem_class = $course->getSemClass() ?> <h4><?= htmlReady($sem_class['title_dozent_plural'] ?: $GLOBALS['DEFAULT_TITLE_FOR_STATUS']['dozent'][1]) ?></h4> |
