Revert r50721 "(bug 18834) Commit Patch from User Joshua C. Lerner <jlerner@gmail...
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 18 May 2009 18:52:53 +0000 (18:52 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 18 May 2009 18:52:53 +0000 (18:52 +0000)
* Fails to explain purpose of patch
* use of SQL variable interpolation without using standard encoded variable naming convention; looks unsafe and makes review harder
* Code has issues already noted; follow-up code was also reverted.
Code needs a little more cooking I think. :)

includes/Linker.php

index e93598e..f3fdb54 100644 (file)
@@ -1621,56 +1621,7 @@ class Linker {
                }
                $query['token'] = $wgUser->editToken( array( $title->getPrefixedText(),
                        $rev->getUserText() ) );
-
-               $dbr = wfGetDB( DB_MASTER );
-
-               // Latest edits by this user, up to 10; if too expensive, use only on smaller wikis
-               $res = $dbr->select( 'revision',
-                       array( 'rev_id' ),
-                       array(  'rev_page' => $rev->getPage(), 
-                               'rev_user_text' => $rev->getUserText()
-                       ), __METHOD__, 
-                       array(  'USE INDEX' => 'page_timestamp',
-                               'ORDER BY' => 'rev_timestamp DESC',
-                               'LIMIT' => 10 ) 
-                       );
-
-               // Swiped from Article::commitRollback()
-               $user = intval( $rev->getUser() );
-               $user_text = $dbr->addQuotes( $rev->getUserText() );
-
-               // Get the last edit not by this guy
-               $s = $dbr->selectRow( 'revision',
-                       array( 'rev_id', 'rev_timestamp', 'rev_deleted' ),
-                       array(  'rev_page' => $rev->getPage(),
-                               "rev_user != {$user} OR rev_user_text != {$user_text}"
-                       ), __METHOD__,
-                       array(  'USE INDEX' => 'page_timestamp',
-                               'ORDER BY'  => 'rev_timestamp DESC' )
-                       );
-
-               if( $s === false ) {
-                       // No one else ever edited this page
-                       return false;
-               } 
-               elseif( $s->rev_deleted & REVISION::DELETED_TEXT || $s->rev_deleted & REVISION::DELETED_USER ) {
-                       // Only admins can see this text
-                       return false;
-               }
-
-               $editCount = 0;
-               while( $row = $dbr->fetchObject( $res ) ) {
-                       $editCount++;
-                       if( $s->rev_id > $row->rev_id ) {
-                               break;
-                       }
-               }
-
-               // We only bother to count up to 10
-               if( $editCount == 10 )
-                       $editCount = '10+';
-
-               return $this->link( $title, wfMsgHtml( 'rollbacklink', $editCount ),
+               return $this->link( $title, wfMsgHtml( 'rollbacklink' ),
                        array( 'title' => wfMsg( 'tooltip-rollback' ) ),
                        $query, array( 'known', 'noclasses' ) );
        }