[MediaWiki-commits] [Gerrit] mediawiki...ApprovedRevs[master]: Remove old ArticleAfterFetchContent hook subscriber

2016-12-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/326550 )

Change subject: Remove old ArticleAfterFetchContent hook subscriber
..


Remove old ArticleAfterFetchContent hook subscriber

Bug: T151973
Change-Id: Ib3dbe701ff486a456ed5a470a295f42c286b65dd
---
M ApprovedRevs.hooks.php
M ApprovedRevs.php
2 files changed, 5 insertions(+), 14 deletions(-)

Approvals:
  Yaron Koren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ApprovedRevs.hooks.php b/ApprovedRevs.hooks.php
index f164800..4abb6fb 100644
--- a/ApprovedRevs.hooks.php
+++ b/ApprovedRevs.hooks.php
@@ -227,25 +227,18 @@
 
ApprovedRevs::addCSS();
 
-   $content = '';
-
-   return true;
-   }
-
-   /**
-* Called for MW 1.21+.
-*/
-   public static function showBlankIfUnapproved2( &$article, 
&$contentObject ) {
// 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, 
$contentObject
// could also be null, so this check is a good idea anyway.)
if ( is_object( $contentObject ) ) {
-   return self::showBlankIfUnapproved( $article, 
$contentObject->mText );
+   $content->mText = '';
} else {
-   return self::showBlankIfUnapproved( $article, 
$contentObject );
+   $content = '';
}
+
+   return true;
}
 
/**
diff --git a/ApprovedRevs.php b/ApprovedRevs.php
index 58fbc36..1890fd8 100644
--- a/ApprovedRevs.php
+++ b/ApprovedRevs.php
@@ -50,9 +50,7 @@
 $wgHooks['SearchResultInitFromTitle'][] = 
'ApprovedRevsHooks::setSearchRevisionID';
 $wgHooks['PersonalUrls'][] = 'ApprovedRevsHooks::removeRobotsTag';
 $wgHooks['ArticleFromTitle'][] = 'ApprovedRevsHooks::showApprovedRevision';
-$wgHooks['ArticleAfterFetchContent'][] = 
'ApprovedRevsHooks::showBlankIfUnapproved';
-// MW 1.21+
-$wgHooks['ArticleAfterFetchContentObject'][] = 
'ApprovedRevsHooks::showBlankIfUnapproved2';
+$wgHooks['ArticleAfterFetchContentObject'][] = 
'ApprovedRevsHooks::showBlankIfUnapproved';
 $wgHooks['DisplayOldSubtitle'][] = 'ApprovedRevsHooks::setSubtitle';
 // it's 'SkinTemplateNavigation' for the Vector skin, 'SkinTemplateTabs' for
 // most other skins

-- 
To view, visit https://gerrit.wikimedia.org/r/326550
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3dbe701ff486a456ed5a470a295f42c286b65dd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: Reedy 
Gerrit-Reviewer: Reedy 
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


[MediaWiki-commits] [Gerrit] mediawiki...ApprovedRevs[master]: Remove old ArticleAfterFetchContent hook subscriber

2016-12-12 Thread Reedy (Code Review)
Reedy has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/326550 )

Change subject: Remove old ArticleAfterFetchContent hook subscriber
..

Remove old ArticleAfterFetchContent hook subscriber

Bug: T151973
Change-Id: Ib3dbe701ff486a456ed5a470a295f42c286b65dd
---
M ApprovedRevs.hooks.php
M ApprovedRevs.php
2 files changed, 5 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ApprovedRevs 
refs/changes/50/326550/1

diff --git a/ApprovedRevs.hooks.php b/ApprovedRevs.hooks.php
index f164800..4abb6fb 100644
--- a/ApprovedRevs.hooks.php
+++ b/ApprovedRevs.hooks.php
@@ -227,25 +227,18 @@
 
ApprovedRevs::addCSS();
 
-   $content = '';
-
-   return true;
-   }
-
-   /**
-* Called for MW 1.21+.
-*/
-   public static function showBlankIfUnapproved2( &$article, 
&$contentObject ) {
// 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, 
$contentObject
// could also be null, so this check is a good idea anyway.)
if ( is_object( $contentObject ) ) {
-   return self::showBlankIfUnapproved( $article, 
$contentObject->mText );
+   $content->mText = '';
} else {
-   return self::showBlankIfUnapproved( $article, 
$contentObject );
+   $content = '';
}
+
+   return true;
}
 
/**
diff --git a/ApprovedRevs.php b/ApprovedRevs.php
index 58fbc36..1890fd8 100644
--- a/ApprovedRevs.php
+++ b/ApprovedRevs.php
@@ -50,9 +50,7 @@
 $wgHooks['SearchResultInitFromTitle'][] = 
'ApprovedRevsHooks::setSearchRevisionID';
 $wgHooks['PersonalUrls'][] = 'ApprovedRevsHooks::removeRobotsTag';
 $wgHooks['ArticleFromTitle'][] = 'ApprovedRevsHooks::showApprovedRevision';
-$wgHooks['ArticleAfterFetchContent'][] = 
'ApprovedRevsHooks::showBlankIfUnapproved';
-// MW 1.21+
-$wgHooks['ArticleAfterFetchContentObject'][] = 
'ApprovedRevsHooks::showBlankIfUnapproved2';
+$wgHooks['ArticleAfterFetchContentObject'][] = 
'ApprovedRevsHooks::showBlankIfUnapproved';
 $wgHooks['DisplayOldSubtitle'][] = 'ApprovedRevsHooks::setSubtitle';
 // it's 'SkinTemplateNavigation' for the Vector skin, 'SkinTemplateTabs' for
 // most other skins

-- 
To view, visit https://gerrit.wikimedia.org/r/326550
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3dbe701ff486a456ed5a470a295f42c286b65dd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: Reedy 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits