From 5cdb26cfac285b401ef243bc2bf185f993356b00 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Thu, 16 Nov 2023 14:44:28 +0100 Subject: [PATCH] Fix memory usage on integrity check (#6660) --- CHANGELOG.md | 1 + protected/humhub/modules/file/Events.php | 2 +- protected/humhub/modules/post/Events.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ac3167df..d135f56e25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ HumHub Changelog - Fix #6645: File dropdown not visible at the bottom of the page - Fix #6639: Apply image inline styles in email message - Fix #6649: Fix birthday format on welcome page +- Fix #6660: Fix memory usage on integrity check 1.15.0 (November 6, 2023) diff --git a/protected/humhub/modules/file/Events.php b/protected/humhub/modules/file/Events.php index a3d8735d3a..c316697146 100644 --- a/protected/humhub/modules/file/Events.php +++ b/protected/humhub/modules/file/Events.php @@ -66,7 +66,7 @@ class Events extends \yii\base\BaseObject $integrityController = $event->sender; $integrityController->showTestHeadline("File Module (" . File::find()->count() . " entries)"); - foreach (File::find()->all() as $file) { + foreach (File::find()->each() as $file) { if ($file->object_model != "" && $file->object_id != "" && $file->getPolymorphicRelation() === null) { if ($integrityController->showFix("Deleting file id " . $file->id . " without existing target!")) { $file->delete(); diff --git a/protected/humhub/modules/post/Events.php b/protected/humhub/modules/post/Events.php index bc437a0bdc..4fa9f9de31 100644 --- a/protected/humhub/modules/post/Events.php +++ b/protected/humhub/modules/post/Events.php @@ -26,7 +26,7 @@ class Events extends \yii\base\BaseObject $integrityController = $event->sender; $integrityController->showTestHeadline("Post Module - Posts (" . Post::find()->count() . " entries)"); - foreach (Post::find()->all() as $post) { + foreach (Post::find()->each() as $post) { /* @var Post $post */ if (empty($post->content->id)) { if ($integrityController->showFix("Deleting post " . $post->id . " without existing content record!")) {