Revert r45166 "Use quickUserCan for UI links"
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 31 Dec 2008 21:16:36 +0000 (21:16 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 31 Dec 2008 21:16:36 +0000 (21:16 +0000)
Use of quickUserCan should be minimized to cases where maximal view speed is more important than accuracy, such as UI that's plastered on every page view.
In page history we're already headed into editor territory, and having an accurate idea of what we can do with editing tools (such as rollback) is relatively important.
Unless it can be shown that checking for cascading protections is a serious problem for site performance, we should continue using accurate checks here.

includes/PageHistory.php

index 5fd81b3..b01b485 100644 (file)
@@ -331,16 +331,14 @@ class PageHistory {
                }
 
                $tools = array();
+
                if( !is_null( $next ) && is_object( $next ) ) {
-                       # Add [rollback] link to current revision
-                       if( $latest && $this->mTitle->quickUserCan( 'rollback' ) && 
-                               $this->mTitle->quickUserCan( 'edit' ) )
-                       {
+                       if( $latest && $this->mTitle->userCan( 'rollback' ) && $this->mTitle->userCan( 'edit' ) ) {
                                $tools[] = '<span class="mw-rollback-link">'.$this->mSkin->buildRollbackLink( $rev ).'</span>';
                        }
-                       # Add (undo) links to revisions
+
                        if( $this->mTitle->quickUserCan( 'edit' ) && !$rev->isDeleted( Revision::DELETED_TEXT ) &&
-                               !($next->rev_deleted & Revision::DELETED_TEXT) )
+                               !$next->rev_deleted & Revision::DELETED_TEXT )
                        {
                                # Create undo tooltip for the first (=latest) line only
                                $undoTooltip = $latest