r104171 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104170‎ | r104171 | r104172 >
Date:15:36, 24 November 2011
Author:reedy
Status:ok
Tags:
Comment:
Fix protected member variable access

Swap to use get/set methods

Add documentation
Modified paths:
  • /trunk/extensions/Oversight/HideRevision.hooks.php (modified) (history)
  • /trunk/extensions/Oversight/HideRevision_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Oversight/HideRevision.hooks.php
@@ -4,9 +4,11 @@
55 /**
66 * Hook for article view, giving us a chance to insert a removal
77 * tab on old version views.
 8+ * @param $article Article
 9+ * @return bool
810 */
911 public static function onArticleViewHeader( $article ) {
10 - $oldid = intval( $article->mOldId );
 12+ $oldid = intval( $article->getOldID() );
1113 if( $oldid ) {
1214 self::installTab( $oldid );
1315 }
@@ -16,6 +18,10 @@
1719 /**
1820 * Hook for diff view, giving us a chance to insert a removal
1921 * tab on old version views.
 22+ * @param $diff
 23+ * @param $oldRev Revision
 24+ * @param $newRev Revision
 25+ * @return bool
2026 */
2127 public static function onDiffViewHeader( $diff, $oldRev, $newRev ) {
2228 if( !empty( $newRev ) && $newRev->getId() ) {
@@ -27,6 +33,9 @@
2834 /**
2935 * Hook for deletion archive revision view, giving us a chance to
3036 * insert a removal tab for a deleted revision.
 37+ * @param $title Title
 38+ * @param $rev Revision
 39+ * @return bool
3140 */
3241 public static function onUndeleteShowRevision( $title, $rev ) {
3342 self::installArchiveTab( $title, $rev->getTimestamp() );
@@ -34,7 +43,10 @@
3544 }
3645
3746 /**
38 - *
 47+ * @param $id
 48+ * @param $nt Title
 49+ * @param $tools
 50+ * @return bool
3951 */
4052 public static function onContributionsToolLinks( $id, $nt, &$tools ) {
4153 global $wgUser;
@@ -48,6 +60,7 @@
4961 /**
5062 * If the user is allowed, installs a tab hook on the skin
5163 * which links to a handy permanent removal thingy.
 64+ * @param $id
5265 */
5366 private static function installTab( $id ) {
5467 global $wgUser;
@@ -62,6 +75,8 @@
6376 * If the user is allowed, installs a tab hook on the skin
6477 * which links to a handy permanent removal thingy for
6578 * archived (deleted) pages.
 79+ * @param $target Title
 80+ * @param $timestamp
6681 */
6782 private static function installArchiveTab( $target, $timestamp ) {
6883 global $wgUser;
@@ -81,6 +96,11 @@
8297 $this->mLinkParam = $linkParam;
8398 }
8499
 100+ /**
 101+ * @param $skin
 102+ * @param $content_actions
 103+ * @return bool
 104+ */
85105 function insertTab( $skin, &$content_actions ) {
86106 $special = SpecialPage::getTitleFor( 'HideRevision' );
87107 $content_actions['hiderevision'] = array(
Index: trunk/extensions/Oversight/HideRevision_body.php
@@ -538,10 +538,11 @@
539539 $info = $this->listRow( $row );
540540 $list = $this->revisionInfo( $row );
541541 $rev = new Revision( $row );
542 - $rev->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
543 - $prevId = $rev->mTitle->getPreviousRevisionID( $row->rev_id );
 542+ $title = Title::makeTitle( $row->page_namespace, $row->page_title );
 543+ $rev->setTitle( $title );
 544+ $prevId = $title->getPreviousRevisionID( $row->rev_id );
544545 if ( $prevId ) {
545 - $prev = Revision::newFromTitle( $rev->mTitle, $prevId );
 546+ $prev = Revision::newFromTitle( $title, $prevId );
546547 if( $prev ) {
547548 $otext = strval( $prev->getText( Revision::FOR_THIS_USER ) );
548549 } else {
@@ -558,7 +559,7 @@
559560 }
560561 $ntext = strval( $rev->getText( Revision::FOR_THIS_USER ) );
561562
562 - $diffEngine = new DifferenceEngine( $rev->mTitle );
 563+ $diffEngine = new DifferenceEngine( $title );
563564 $diffEngine->showDiffStyle();
564565 $wgOut->addHTML(
565566 "<ul>" .

Status & tagging log