Skip to content

Commit 6c26c17

Browse files
committed
fixed broken use of Job Queue
1 parent 655e9e7 commit 6c26c17

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

Diff for: SemanticDependencyUpdater.hooks.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,16 @@ public static function dummyEdit( $title ) {
148148
$page = WikiPage::newFromID( $title->getArticleId() );
149149
if ( $page ) { // prevent NPE when page not found
150150
$content = $page->getContent( Revision::RAW );
151-
$text = ContentHandler::getContentText( $content );
152-
$page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
153-
"[SemanticDependencyUpdater] Null edit." ); // since this is a null edit, the edit summary will be ignored.
154-
$page->doPurge(); // required since SMW 2.5.1
151+
152+
if ( $content ) {
153+
$text = ContentHandler::getContentText( $content );
154+
$page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
155+
"[SemanticDependencyUpdater] Null edit." ); // since this is a null edit, the edit summary will be ignored.
156+
$page->doPurge(); // required since SMW 2.5.1
157+
158+
# Consider calling doSecondaryDataUpdates() for MW 1.32+
159+
# https://doc.wikimedia.org/mediawiki-core/master/php/classWikiPage.html#ac761e927ec2e7d95c9bb48aac60ff7c8
160+
}
155161
}
156162
}
157163
}

Diff for: extension.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
]
2828
},
2929
"JobClasses": {
30-
"SDU\\DummyEditJob": "DummyEditJob"
30+
"DummyEditJob": "SDU\\DummyEditJob"
3131
},
3232
"callback": "SDU\\Hooks::setup",
3333
"config": {

Diff for: includes/DummyEditJob.php

+11-13
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,22 @@ function __construct( $title, $params = '', $id = 0 ) {
1818
* @return boolean success
1919
*/
2020
function run() {
21-
wfProfileIn( __METHOD__ );
22-
23-
if ( is_null( $this->title ) ) {
24-
$this->error = "DummyEditJob: Invalid title";
25-
wfProfileOut( __METHOD__ );
26-
return false;
27-
}
28-
2921
$page = WikiPage::newFromID( $this->title->getArticleId() );
3022
if ( $page ) { // prevent NPE when page not found
3123
$content = $page->getContent( Revision::RAW );
32-
$text = ContentHandler::getContentText( $content );
33-
$page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
34-
"[SemanticDependencyUpdater] Null edit." ); // since this is a null edit, the edit summary will be ignored.
35-
$page->doPurge(); // required since SMW 2.5.1
24+
25+
if ( $content ) {
26+
$text = ContentHandler::getContentText( $content );
27+
$page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
28+
"[SemanticDependencyUpdater] Null edit." ); // since this is a null edit, the edit summary will be ignored.
29+
$page->doPurge(); // required since SMW 2.5.1
30+
31+
# Consider calling doSecondaryDataUpdates() for MW 1.32+
32+
# https://doc.wikimedia.org/mediawiki-core/master/php/classWikiPage.html#ac761e927ec2e7d95c9bb48aac60ff7c8
33+
}
34+
3635
}
3736

38-
wfProfileOut( __METHOD__ );
3937
return true;
4038
}
4139
}

0 commit comments

Comments
 (0)