jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/404167 )
Change subject: Error when displaying a blank page
..
Error when displaying a blank page
When the content is set to blank for unapproved revisions, an error
was displayed instead since MediaWiki 1.31-alpha.
Bug: T184877
Change-Id: Idb16ca46f3a1ee7dd32c3925d9a985d0ba8193a3
---
M ApprovedRevs.hooks.php
1 file changed, 12 insertions(+), 9 deletions(-)
Approvals:
Yaron Koren: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ApprovedRevs.hooks.php b/ApprovedRevs.hooks.php
index 6d35378..d0f5c50 100644
--- a/ApprovedRevs.hooks.php
+++ b/ApprovedRevs.hooks.php
@@ -203,7 +203,14 @@
return true;
}
- public static function showBlankIfUnapproved( &$article, &$content ) {
+ /**
+* Hook: ArticleAfterFetchContentObject
+*
+* @param Article $article
+* @param Content $content
+* @return true
+*/
+ public static function showBlankIfUnapproved( &$article, Content
&$content ) {
global $egApprovedRevsBlankIfUnapproved;
if ( ! $egApprovedRevsBlankIfUnapproved ) {
return true;
@@ -236,13 +243,9 @@
ApprovedRevs::addCSS();
// Set the content to blank.
- // There's possibly a bug in MW 1.28, where the second argument
- // (called from the hook 'ArticleAfterFetchContentObject') is
- // sometimes (or always?) a string, instead of a Content object.
- // We'll just get around it here with a check. (In theory,
$content
- // could also be null, so this check is a good idea anyway.)
- if ( is_object( $content ) ) {
- $content->mText = '';
+ if( $content instanceof TextContent ) {
+ $contentClass = get_class( $content );
+ $content = new $contentClass( '' );
} else {
$content = '';
}
@@ -950,4 +953,4 @@
$qp['SpecialApprovedRevsPage'] = 'ApprovedRevs';
return true;
}
-}
\ No newline at end of file
+}
--
To view, visit https://gerrit.wikimedia.org/r/404167
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idb16ca46f3a1ee7dd32c3925d9a985d0ba8193a3
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: Seb35
Gerrit-Reviewer: Seb35
Gerrit-Reviewer: Yaron Koren
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits