Merge "Add new-inline-tags to tidy.conf"
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index 39e555e..37a732b 100644 (file)
@@ -1,6 +1,21 @@
 <?php
 /**
- * User interface for the difference engine
+ * User interface for the difference engine.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
  * @ingroup DifferenceEngine
@@ -261,7 +276,7 @@ class DifferenceEngine extends ContextSource {
                                $samePage = false;
                        }
 
-                       if ( $samePage && $this->mNewPage->userCan( 'edit', $user ) ) {
+                       if ( $samePage && $this->mNewPage->quickUserCan( 'edit', $user ) ) {
                                if ( $this->mNewRev->isCurrent() && $this->mNewPage->userCan( 'rollback', $user ) ) {
                                        $out->preventClickjacking();
                                        $rollback = '&#160;&#160;&#160;' . Linker::generateRollback( $this->mNewRev );
@@ -403,7 +418,7 @@ class DifferenceEngine extends ContextSource {
 
                if ( $this->mMarkPatrolledLink === null ) {
                        // Prepare a change patrol link, if applicable
-                       if ( $wgUseRCPatrol && $this->mNewPage->userCan( 'patrol', $this->getUser() ) ) {
+                       if ( $wgUseRCPatrol && $this->mNewPage->quickUserCan( 'patrol', $this->getUser() ) ) {
                                // If we've been given an explicit change identifier, use it; saves time
                                if ( $this->mRcidMarkPatrolled ) {
                                        $rcid = $this->mRcidMarkPatrolled;
@@ -867,7 +882,7 @@ class DifferenceEngine extends ContextSource {
                                $editQuery['oldid'] = $rev->getID();
                        }
 
-                       $msg = $this->msg( $title->userCan( 'edit', $user ) ? 'editold' : 'viewsourceold' )->escaped();
+                       $msg = $this->msg( $title->quickUserCan( 'edit', $user ) ? 'editold' : 'viewsourceold' )->escaped();
                        $header .= ' (' . Linker::linkKnown( $title, $msg, array(), $editQuery ) . ')';
                        if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
                                $header = Html::rawElement( 'span', array( 'class' => 'history-deleted' ), $header );
@@ -1003,23 +1018,17 @@ class DifferenceEngine extends ContextSource {
                $this->loadRevisionIds();
 
                // Load the new revision object
-               if ( $this->mNewid && ( !$this->canUseWikiPage()
-                       || $this->mNewid !== $this->getWikiPage()->getLatest() ) )
-               {
-                       $this->mNewRev = Revision::newFromId( $this->mNewid );
-               } else {
-                       $this->mNewRev = $this->getWikiPage()->getRevision();
-                       $this->mNewPage = $this->getTitle();
-               }
+               $this->mNewRev = $this->mNewid
+                       ? Revision::newFromId( $this->mNewid )
+                       : Revision::newFromTitle( $this->getTitle() );
 
                if ( !$this->mNewRev instanceof Revision ) {
                        return false;
                }
-               if ( !$this->mNewPage instanceof Title ) {
-                       $this->mNewPage = $this->mNewRev->getTitle();
-               }
+
                // Update the new revision ID in case it was 0 (makes life easier doing UI stuff)
                $this->mNewid = $this->mNewRev->getId();
+               $this->mNewPage = $this->mNewRev->getTitle();
 
                // Load the old revision object
                $this->mOldRev = false;