Skip to content

Commit

Permalink
Fire the 'run' GC event before deleting orphaned revisions
Browse files Browse the repository at this point in the history
Fixes #14309
  • Loading branch information
brandonkelly committed May 13, 2024
1 parent 6aeb5a9 commit 7723ede
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed a SQL error that could occur when applying or rebuilding the project config.
- Fixed a bug where adjacent selected table rows were getting extra spacing in Firefox.
- Fixed a SQL error that could occur when creating revisions after garbage collection was run. ([#14309](https://github.com/craftcms/cms/issues/14309))

## 4.9.2 - 2024-05-07

Expand Down
12 changes: 7 additions & 5 deletions src/services/Gc.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,18 @@ public function run(bool $force = false): void

$this->_deleteUnsupportedSiteEntries();

$this->_deleteOrphanedDraftsAndRevisions();
$this->_deleteOrphanedSearchIndexes();
$this->_deleteOrphanedRelations();
$this->_deleteOrphanedStructureElements();

// Fire a 'run' event
// Note this should get fired *before* orphaned drafts & revisions are deleted
// (see https://github.com/craftcms/cms/issues/14309)
if ($this->hasEventHandlers(self::EVENT_RUN)) {
$this->trigger(self::EVENT_RUN);
}

$this->_deleteOrphanedDraftsAndRevisions();
$this->_deleteOrphanedSearchIndexes();
$this->_deleteOrphanedRelations();
$this->_deleteOrphanedStructureElements();

$this->hardDelete([
Table::STRUCTURES,
Table::FIELDLAYOUTS,
Expand Down

0 comments on commit 7723ede

Please sign in to comment.