Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory usage on integrity check #433

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public static function onIntegrityCheck($event)
$integrityController = $event->sender;
$integrityController->showTestHeadline("Calendar Module (" . CalendarReminder::find()->count() . " reminder entries)");

foreach (CalendarReminder::find()->all() as $reminder) {
foreach (CalendarReminder::find()->each() as $reminder) {
if ($reminder->isEntryLevelReminder() && !Content::findOne(['id' => $reminder->content_id])) {
if ($integrityController->showFix("Delete calendar reminder " . $reminder->id . " without existing entry relation!")) {
$reminder->delete();
Expand All @@ -316,7 +316,7 @@ public static function onIntegrityCheck($event)

$integrityController->showTestHeadline("Calendar Module (" . CalendarReminderSent::find()->count() . " reminder sent entries)");

foreach (CalendarReminderSent::find()->all() as $reminderSent) {
foreach (CalendarReminderSent::find()->each() as $reminderSent) {
if(!Content::findOne(['id' => $reminderSent->content_id])) {
if ($integrityController->showFix("Delete calendar reminder sent" . $reminderSent->id . " without existing entry relation!")) {
$reminderSent->delete();
Expand All @@ -332,13 +332,13 @@ public static function onIntegrityCheck($event)
->groupBy('parent_event_id, recurrence_id')
->having('COUNT(*) > 1')->asArray(true);

foreach ($duplicatedRecurrences->all() as $duplicatedRecurrenceArr) {
foreach ($duplicatedRecurrences->each() as $duplicatedRecurrenceArr) {
$duplicateQuery = CalendarEntry::find()
->where(['recurrence_id' => $duplicatedRecurrenceArr['recurrence_id']])
->andWhere(['parent_event_id' => $duplicatedRecurrenceArr['parent_event_id']])
->andWhere(['<>', 'id', $duplicatedRecurrenceArr['id']]);

foreach ($duplicateQuery->all() as $duplicate) {
foreach ($duplicateQuery->each() as $duplicate) {
if(RecurrenceHelper::isRecurrentInstance($duplicate) && $duplicate->id !== $duplicatedRecurrenceArr['id']) {
if ($integrityController->showFix('Delete duplicated recurrent event instance ' . $duplicate->id . '!')) {
$duplicate->hardDelete();
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.5.7 (Unreleased)
--------------------------
- Fix #433: Fix memory usage on integrity check

1.5.6 (October 26, 2023)
--------------------------
- Enh #429: Add additional data to participant export
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Calendar",
"description": "Calendar for spaces or user profiles.",
"keywords": ["calendar"],
"version": "1.5.6",
"version": "1.5.7",
"humhub": {
"minVersion": "1.14"
},
Expand Down