Skip to content

Commit

Permalink
Fixes REL1_39 compatibility
Browse files Browse the repository at this point in the history
Changes hook to onPageDelete because there is already no data
by the time SMW::SQLStore::BeforeDeleteSubjectComplete fires.
  • Loading branch information
vedmaka authored and labster committed Jun 5, 2024
1 parent 4bb66c3 commit 6e956de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"SMW::SQLStore::AfterDataUpdateComplete": [
"SDU\\Hooks::onAfterDataUpdateComplete"
],
"SMW::SQLStore::BeforeDeleteSubjectComplete": [
"SDU\\Hooks::onBeforeDeleteSubjectComplete"
"PageDelete": [
"SDU\\Hooks::onPageDelete"
]
},
"callback": "SDU\\Hooks::setup",
Expand Down
7 changes: 5 additions & 2 deletions src/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ public static function setup() {
}
}

public static function onBeforeDeleteSubjectComplete( SMWStore $store, Title $title ) {
$diWikiPage = SMWDIWikiPage::newFromTitle( $title );
// Note: at the time SMW::SQLStore::BeforeDeleteSubjectComplete fires there is no data already
// so the PageDelete hook is used
public static function onPageDelete( $page, $deleter, string $reason, $status, bool $suppress ) {
$store = smwfGetStore();
$diWikiPage = SMWDIWikiPage::newFromTitle( Title::newFromDBkey( $page->getDBkey() ) );
$smwData = $store->getSemanticData( $diWikiPage );
self::onAfterDataUpdateComplete( $store, $smwData, null );
}
Expand Down

0 comments on commit 6e956de

Please sign in to comment.