mirror of
https://github.com/humhub/humhub.git
synced 2025-03-14 20:19:47 +01:00
Hard delete content records on integrity check (#6282)
This commit is contained in:
parent
7dd5c4ec89
commit
7e391224f7
@ -10,6 +10,7 @@ HumHub Changelog
|
||||
- Fix #6264: Fix date format for columns `created_at` and `updated_at`
|
||||
- Fix #6265: Broken HMTL in Visibility and Hidden Checkbox
|
||||
- Enh #6242: Submit button hidden when editing a comment having a long "code" line
|
||||
- Fix #6282: Hard delete content records on integrity check
|
||||
|
||||
1.14.0 (April 20, 2023)
|
||||
-----------------------
|
||||
|
@ -130,19 +130,19 @@ class Events extends BaseObject
|
||||
$source = $a->getSource();
|
||||
} catch (IntegrityException $ex) {
|
||||
if ($integrityController->showFix('Deleting activity id ' . $a->id . ' without existing target! (' . $a->object_model . ')')) {
|
||||
$a->delete();
|
||||
$a->hardDelete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for moduleId is set
|
||||
if (empty($a->module) && $integrityController->showFix('Deleting activity id ' . $a->id . ' without module_id!')) {
|
||||
$a->delete();
|
||||
$a->hardDelete();
|
||||
}
|
||||
|
||||
// Check Activity class exists
|
||||
if (!class_exists($a->class) && $integrityController->showFix('Deleting activity id ' . $a->id . ' class not exists! (' . $a->class . ')')) {
|
||||
$a->delete();
|
||||
$a->hardDelete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,14 +79,15 @@ class Events extends BaseObject
|
||||
|
||||
$integrityController->showTestHeadline('Content Objects (' . Content::find()->count() . ' entries)');
|
||||
foreach (Content::find()->each() as $content) {
|
||||
/* @var Content $content */
|
||||
if ($content->createdBy == null) {
|
||||
if ($integrityController->showFix('Deleting content id ' . $content->id . ' of type ' . $content->object_model . ' without valid user!')) {
|
||||
$content->delete();
|
||||
$content->hardDelete();
|
||||
}
|
||||
}
|
||||
if ($content->getPolymorphicRelation() === null) {
|
||||
if ($integrityController->showFix('Deleting content id ' . $content->id . ' of type ' . $content->object_model . ' without valid content object!')) {
|
||||
$content->delete();
|
||||
$content->hardDelete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,10 @@ class Events extends \yii\base\BaseObject
|
||||
|
||||
$integrityController->showTestHeadline("Post Module - Posts (" . Post::find()->count() . " entries)");
|
||||
foreach (Post::find()->all() as $post) {
|
||||
/* @var Post $post */
|
||||
if (empty($post->content->id)) {
|
||||
if ($integrityController->showFix("Deleting post " . $post->id . " without existing content record!")) {
|
||||
$post->delete();
|
||||
$post->hardDelete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user