Skip to content

Commit

Permalink
Merge pull request #245 from humhub/fix/198-integrity-check-memory-usage
Browse files Browse the repository at this point in the history
Fix memory usage on integrity check
  • Loading branch information
luke- authored Nov 16, 2023
2 parents f204848 + 006156a commit 5c35e5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static function onIntegrityCheck($event)
$integrityController->showTestHeadline("Tasks Module - Entries (" . Task::find()->count() . " entries)");

// check for taskItems without task
foreach (TaskItem::find()->all() as $taskItem) {
foreach (TaskItem::find()->each() as $taskItem) {
if ($taskItem->task === null) {
if ($integrityController->showFix("Deleting task item id " . $taskItem->id . " without existing task!")) {
$taskItem->hardDelete();
Expand All @@ -198,7 +198,7 @@ public static function onIntegrityCheck($event)
}

// check for task responsible users without task or existing user
foreach (TaskUser::find()->all() as $taskUser) {
foreach (TaskUser::find()->each() as $taskUser) {
if ($taskUser->task === null) {
if ($integrityController->showFix("Deleting task user user id " . $taskUser->id . " without existing task!")) {
$taskUser->delete();
Expand All @@ -213,7 +213,7 @@ public static function onIntegrityCheck($event)

$integrityController->showTestHeadline("Tasks Module (" . Task::find()->count() . " entries)");

foreach (Task::find()->all() as $task) {
foreach (Task::find()->each() as $task) {
if ($task->task_list_id != null && !$task->list) {
if ($integrityController->showFix("Reset task list for task" . $task->id . " with invalid task_list_setting!")) {
$task->updateAttributes(['task_list_id' => new Expression('NULL')]);
Expand All @@ -222,7 +222,7 @@ public static function onIntegrityCheck($event)
}

// // check for task responsible users without task or existing user
// foreach (TaskResponsible::find()->all() as $taskResponsible) {
// foreach (TaskResponsible::find()->each() as $taskResponsible) {
// if ($taskResponsible->task === null) {
// if ($integrityController->showFix("Deleting task responsible user id " . $taskResponsible->id . " without existing task!")) {
// $taskResponsible->delete();
Expand All @@ -236,7 +236,7 @@ public static function onIntegrityCheck($event)
// }

// // check for task assigned users without task or existing user
// foreach (TaskAssigned::find()->all() as $taskAssigned) {
// foreach (TaskAssigned::find()->each() as $taskAssigned) {
// if ($taskAssigned->task === null) {
// if ($integrityController->showFix("Deleting task assigned user id " . $taskAssigned->id . " without existing task!")) {
// $taskAssigned->delete();
Expand All @@ -250,7 +250,7 @@ public static function onIntegrityCheck($event)
// }

// check for task reminders without task
foreach (TaskReminder::find()->all() as $taskReminder) {
foreach (TaskReminder::find()->each() as $taskReminder) {
if ($taskReminder->task === null) {
if ($integrityController->showFix("Deleting task reminder id " . $taskReminder->id . " without existing task!")) {
$taskReminder->delete();
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changelog
- Fix #236: Fix pagination design
- Enh #238: Tests for `next` version
- Fix #242: Fix visibility of the method `Controller::getAccessRules()`
- Fix #245: Fix memory usage on integrity check

1.8.1 (May 1, 2023)
-------------------
Expand Down

0 comments on commit 5c35e5d

Please sign in to comment.