r111382 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111381‎ | r111382 | r111383 >
Date:16:07, 13 February 2012
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/REL1_19/extensions (modified) (history)
  • /branches/REL1_19/extensions/CategoryTree/CategoryTree.php (modified) (history)
  • /branches/REL1_19/phase3 (modified) (history)
  • /branches/REL1_19/phase3/includes (modified) (history)
  • /branches/REL1_19/phase3/includes/actions/HistoryAction.php (modified) (history)
  • /branches/REL1_19/phase3/includes/specials (modified) (history)
  • /branches/REL1_19/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /branches/wmf/1.19wmf1 (modified) (history)
  • /branches/wmf/1.19wmf1/extensions (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTree.php (modified) (history)
  • /branches/wmf/1.19wmf1/includes (modified) (history)
  • /branches/wmf/1.19wmf1/includes/actions/HistoryAction.php (modified) (history)
  • /branches/wmf/1.19wmf1/includes/specials (modified) (history)
  • /branches/wmf/1.19wmf1/includes/specials/SpecialContributions.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTree.php
@@ -170,7 +170,7 @@
171171 * Hook it up
172172 */
173173 function efCategoryTree() {
174 - global $wgUseAjax, $wgHooks, $wgOut;
 174+ global $wgUseAjax, $wgHooks, $wgOut, $wgRequest;
175175 global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode, $wgCategoryTreeOmitNamespace;
176176 global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode, $wgCategoryTreeAllowTag;
177177 global $wgCategoryTreeSidebarRoot, $wgCategoryTreeForceHeaders, $wgCategoryTreeHijackPageCategories;
@@ -204,8 +204,8 @@
205205 $wgCategoryTreeDefaultOptions['hideprefix'] = $wgCategoryTreeOmitNamespace;
206206 }
207207
208 - if ( !isset( $wgCategoryTreeCategoryPageOptions['mode'] ) || is_null( $wgCategoryTreeCategoryPageOptions['mode'] ) ) {
209 - $wgCategoryTreeCategoryPageOptions['mode'] = $wgCategoryTreeCategoryPageMode;
 208+ if ( !isset( $wgCategoryTreeCategoryPageOptions['mode'] ) || is_null( $wgCategoryTreeCategoryPageOptions['mode'] ) ) {
 209+ $wgCategoryTreeCategoryPageOptions['mode'] = ( $mode = $wgRequest->getVal( 'mode' ) ) ? CategoryTree::decodeMode( $mode ) : $wgCategoryTreeCategoryPageMode;
210210 }
211211
212212 if ( $wgCategoryTreeForceHeaders ) {
@@ -214,7 +214,7 @@
215215 $wgHooks['OutputPageParserOutput'][] = 'efCategoryTreeParserOutput';
216216 }
217217
218 - $wgHooks['ResourceLoaderGetConfigVars'][] = 'efCategoryTreeGetConfigVars';
 218+ $wgHooks['MakeGlobalVariablesScript'][] = 'efCategoryTreeGetConfigVars';
219219 }
220220
221221 function efCategoryTreeSetHooks( $parser ) {
Property changes on: branches/wmf/1.19wmf1/extensions
___________________________________________________________________
Added: svn:mergeinfo
222222 Merged /branches/REL1_17/phase3/extensions:r81445,81448
223223 Merged /trunk/extensions:r111218
224224 Merged /branches/sqlite/extensions:r58211-58321
225225 Merged /trunk/phase3/extensions:r111002,111029,111034,111062,111067,111076,111085,111128,111144,111251
226226 Merged /branches/new-installer/phase3/extensions:r43664-66004
227227 Merged /branches/JSTesting/extensions:r100352-107913
228228 Merged /branches/REL1_15/phase3/extensions:r51646
229229 Merged /branches/wmf/1.18wmf1/extensions:r97508
Index: branches/wmf/1.19wmf1/includes/actions/HistoryAction.php
@@ -385,8 +385,13 @@
386386 $this->mResult->seek( 0 );
387387 $batch = new LinkBatch();
388388 foreach ( $this->mResult as $row ) {
389 - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
390 - $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
 389+ if( !is_null( $row->user_name ) ) {
 390+ $batch->add( NS_USER, $row->user_name );
 391+ $batch->add( NS_USER_TALK, $row->user_name );
 392+ } else { # for anons or usernames of imported revisions
 393+ $batch->add( NS_USER, $row->rev_user_text );
 394+ $batch->add( NS_USER_TALK, $row->rev_user_text );
 395+ }
391396 }
392397 $batch->execute();
393398 $this->mResult->seek( 0 );
@@ -568,13 +573,10 @@
569574 $s .= ' ' . ChangesList::flag( 'minor' );
570575 }
571576
572 - if ( $prevRev
573 - && !$prevRev->isDeleted( Revision::DELETED_TEXT )
574 - && !$rev->isDeleted( Revision::DELETED_TEXT ) )
575 - {
576 - $sDiff = ChangesList::showCharacterDifference( $prevRev->getSize(), $rev->getSize() );
577 - $s .= ' . . ' . $sDiff . ' . . ';
578 - }
 577+ # Size is always public data
 578+ $prevSize = $prevRev ? $prevRev->getSize() : 0;
 579+ $sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() );
 580+ $s .= ' . . ' . $sDiff . ' . . ';
579581
580582 $s .= Linker::revComment( $rev, false, true );
581583
Property changes on: branches/wmf/1.19wmf1/includes/actions/HistoryAction.php
___________________________________________________________________
Modified: svn:mergeinfo
582584 Merged /trunk/phase3/includes/actions/HistoryAction.php:r111251
Index: branches/wmf/1.19wmf1/includes/specials/SpecialContributions.php
@@ -511,9 +511,9 @@
512512 $filterSelection .
513513 Xml::closeElement( 'tr' ) .
514514 Xml::openElement( 'tr' ) .
515 - $extraOptions .
516 - Xml::closeElement( 'tr' ) .
517 - Xml::openElement( 'tr' ) .
 515+ $extraOptions .
 516+ Xml::closeElement( 'tr' ) .
 517+ Xml::openElement( 'tr' ) .
518518 $dateSelectionAndSubmit .
519519 Xml::closeElement( 'tr' ) .
520520 Xml::closeElement( 'table' );
@@ -677,23 +677,26 @@
678678 $this->mResult->rewind();
679679 $revIds = array();
680680 foreach ( $this->mResult as $row ) {
681 - $revIds[] = $row->rev_parent_id;
 681+ if( $row->rev_parent_id ) {
 682+ $revIds[] = $row->rev_parent_id;
 683+ }
682684 }
683685 $this->mParentLens = $this->getParentLengths( $revIds );
684686 $this->mResult->rewind(); // reset
685687
686 - if ( $this->contribs === 'newbie' ) { // multiple users
687 - # Do a link batch query
688 - $this->mResult->seek( 0 );
689 - $batch = new LinkBatch();
690 - # Give some pointers to make (last) links
691 - foreach ( $this->mResult as $row ) {
692 - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
693 - $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
 688+ # Do a link batch query
 689+ $this->mResult->seek( 0 );
 690+ $batch = new LinkBatch();
 691+ # Give some pointers to make (last) links
 692+ foreach ( $this->mResult as $row ) {
 693+ if ( $this->contribs === 'newbie' ) { // multiple users
 694+ $batch->add( NS_USER, $row->user_name );
 695+ $batch->add( NS_USER_TALK, $row->user_name );
694696 }
695 - $batch->execute();
696 - $this->mResult->seek( 0 );
 697+ $batch->add( $row->page_namespace, $row->page_title );
697698 }
 699+ $batch->execute();
 700+ $this->mResult->seek( 0 );
698701 }
699702
700703 /**
@@ -787,12 +790,9 @@
788791 array( 'action' => 'history' )
789792 );
790793
791 - if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) {
792 - $chardiff = ' . . ' . ChangesList::showCharacterDifference(
793 - $this->mParentLens[$row->rev_parent_id], $row->rev_len ) . ' . . ';
794 - } else {
795 - $chardiff = ' ';
796 - }
 794+ $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? $this->mParentLens[$row->rev_parent_id] : 0;
 795+ $chardiff = ' . . ' . ChangesList::showCharacterDifference(
 796+ $parentLen, $row->rev_len ) . ' . . ';
797797
798798 $lang = $this->getLanguage();
799799 $comment = $lang->getDirMark() . Linker::revComment( $rev, false, true );
Property changes on: branches/wmf/1.19wmf1/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
800800 Merged /trunk/phase3/includes/specials:r111251
Property changes on: branches/wmf/1.19wmf1/includes
___________________________________________________________________
Modified: svn:mergeinfo
801801 Merged /trunk/phase3/includes:r111251
Property changes on: branches/wmf/1.19wmf1
___________________________________________________________________
Modified: svn:mergeinfo
802802 Merged /trunk/phase3:r111251
Index: branches/REL1_19/extensions/CategoryTree/CategoryTree.php
@@ -170,7 +170,7 @@
171171 * Hook it up
172172 */
173173 function efCategoryTree() {
174 - global $wgUseAjax, $wgHooks, $wgOut;
 174+ global $wgUseAjax, $wgHooks, $wgOut, $wgRequest;
175175 global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode, $wgCategoryTreeOmitNamespace;
176176 global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode, $wgCategoryTreeAllowTag;
177177 global $wgCategoryTreeSidebarRoot, $wgCategoryTreeForceHeaders, $wgCategoryTreeHijackPageCategories;
@@ -204,8 +204,8 @@
205205 $wgCategoryTreeDefaultOptions['hideprefix'] = $wgCategoryTreeOmitNamespace;
206206 }
207207
208 - if ( !isset( $wgCategoryTreeCategoryPageOptions['mode'] ) || is_null( $wgCategoryTreeCategoryPageOptions['mode'] ) ) {
209 - $wgCategoryTreeCategoryPageOptions['mode'] = $wgCategoryTreeCategoryPageMode;
 208+ if ( !isset( $wgCategoryTreeCategoryPageOptions['mode'] ) || is_null( $wgCategoryTreeCategoryPageOptions['mode'] ) ) {
 209+ $wgCategoryTreeCategoryPageOptions['mode'] = ( $mode = $wgRequest->getVal( 'mode' ) ) ? CategoryTree::decodeMode( $mode ) : $wgCategoryTreeCategoryPageMode;
210210 }
211211
212212 if ( $wgCategoryTreeForceHeaders ) {
@@ -214,7 +214,7 @@
215215 $wgHooks['OutputPageParserOutput'][] = 'efCategoryTreeParserOutput';
216216 }
217217
218 - $wgHooks['ResourceLoaderGetConfigVars'][] = 'efCategoryTreeGetConfigVars';
 218+ $wgHooks['MakeGlobalVariablesScript'][] = 'efCategoryTreeGetConfigVars';
219219 }
220220
221221 function efCategoryTreeSetHooks( $parser ) {
Property changes on: branches/REL1_19/extensions
___________________________________________________________________
Added: svn:mergeinfo
222222 Merged /trunk/extensions:r111218
Index: branches/REL1_19/phase3/includes/actions/HistoryAction.php
@@ -385,8 +385,13 @@
386386 $this->mResult->seek( 0 );
387387 $batch = new LinkBatch();
388388 foreach ( $this->mResult as $row ) {
389 - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
390 - $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
 389+ if( !is_null( $row->user_name ) ) {
 390+ $batch->add( NS_USER, $row->user_name );
 391+ $batch->add( NS_USER_TALK, $row->user_name );
 392+ } else { # for anons or usernames of imported revisions
 393+ $batch->add( NS_USER, $row->rev_user_text );
 394+ $batch->add( NS_USER_TALK, $row->rev_user_text );
 395+ }
391396 }
392397 $batch->execute();
393398 $this->mResult->seek( 0 );
@@ -568,13 +573,10 @@
569574 $s .= ' ' . ChangesList::flag( 'minor' );
570575 }
571576
572 - if ( $prevRev
573 - && !$prevRev->isDeleted( Revision::DELETED_TEXT )
574 - && !$rev->isDeleted( Revision::DELETED_TEXT ) )
575 - {
576 - $sDiff = ChangesList::showCharacterDifference( $prevRev->getSize(), $rev->getSize() );
577 - $s .= ' . . ' . $sDiff . ' . . ';
578 - }
 577+ # Size is always public data
 578+ $prevSize = $prevRev ? $prevRev->getSize() : 0;
 579+ $sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() );
 580+ $s .= ' . . ' . $sDiff . ' . . ';
579581
580582 $s .= Linker::revComment( $rev, false, true );
581583
Property changes on: branches/REL1_19/phase3/includes/actions/HistoryAction.php
___________________________________________________________________
Modified: svn:mergeinfo
582584 Merged /trunk/phase3/includes/actions/HistoryAction.php:r111251
Index: branches/REL1_19/phase3/includes/specials/SpecialContributions.php
@@ -511,9 +511,9 @@
512512 $filterSelection .
513513 Xml::closeElement( 'tr' ) .
514514 Xml::openElement( 'tr' ) .
515 - $extraOptions .
516 - Xml::closeElement( 'tr' ) .
517 - Xml::openElement( 'tr' ) .
 515+ $extraOptions .
 516+ Xml::closeElement( 'tr' ) .
 517+ Xml::openElement( 'tr' ) .
518518 $dateSelectionAndSubmit .
519519 Xml::closeElement( 'tr' ) .
520520 Xml::closeElement( 'table' );
@@ -677,23 +677,26 @@
678678 $this->mResult->rewind();
679679 $revIds = array();
680680 foreach ( $this->mResult as $row ) {
681 - $revIds[] = $row->rev_parent_id;
 681+ if( $row->rev_parent_id ) {
 682+ $revIds[] = $row->rev_parent_id;
 683+ }
682684 }
683685 $this->mParentLens = $this->getParentLengths( $revIds );
684686 $this->mResult->rewind(); // reset
685687
686 - if ( $this->contribs === 'newbie' ) { // multiple users
687 - # Do a link batch query
688 - $this->mResult->seek( 0 );
689 - $batch = new LinkBatch();
690 - # Give some pointers to make (last) links
691 - foreach ( $this->mResult as $row ) {
692 - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
693 - $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
 688+ # Do a link batch query
 689+ $this->mResult->seek( 0 );
 690+ $batch = new LinkBatch();
 691+ # Give some pointers to make (last) links
 692+ foreach ( $this->mResult as $row ) {
 693+ if ( $this->contribs === 'newbie' ) { // multiple users
 694+ $batch->add( NS_USER, $row->user_name );
 695+ $batch->add( NS_USER_TALK, $row->user_name );
694696 }
695 - $batch->execute();
696 - $this->mResult->seek( 0 );
 697+ $batch->add( $row->page_namespace, $row->page_title );
697698 }
 699+ $batch->execute();
 700+ $this->mResult->seek( 0 );
698701 }
699702
700703 /**
@@ -787,12 +790,9 @@
788791 array( 'action' => 'history' )
789792 );
790793
791 - if ( isset( $this->mParentLens[$row->rev_parent_id] ) ) {
792 - $chardiff = ' . . ' . ChangesList::showCharacterDifference(
793 - $this->mParentLens[$row->rev_parent_id], $row->rev_len ) . ' . . ';
794 - } else {
795 - $chardiff = ' ';
796 - }
 794+ $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? $this->mParentLens[$row->rev_parent_id] : 0;
 795+ $chardiff = ' . . ' . ChangesList::showCharacterDifference(
 796+ $parentLen, $row->rev_len ) . ' . . ';
797797
798798 $lang = $this->getLanguage();
799799 $comment = $lang->getDirMark() . Linker::revComment( $rev, false, true );
Property changes on: branches/REL1_19/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
800800 Merged /trunk/phase3/includes/specials:r111251
Property changes on: branches/REL1_19/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
801801 Merged /trunk/phase3/includes:r111251
Property changes on: branches/REL1_19/phase3
___________________________________________________________________
Modified: svn:mergeinfo
802802 Merged /trunk/phase3:r111251

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111218attempt to fix bug33989 - fix the mode parameter in api callbsitu23:41, 10 February 2012
r111251fixes Bug 34198 - first item in the history shows no information about its size...mah18:11, 11 February 2012

Status & tagging log