From a3d2755660a9cd8f94911ef10a8aebf8850feaf8 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 16 Sep 2011 16:55:39 +0000 Subject: [PATCH 1/1] Revert r91561 --- RELEASE-NOTES-1.18 | 2 -- includes/Skin.php | 3 +-- includes/SkinTemplate.php | 5 ++--- includes/Title.php | 24 ++++-------------------- includes/specials/SpecialUndelete.php | 7 ------- includes/specials/SpecialUpload.php | 7 +++---- languages/Language.php | 7 +++---- 7 files changed, 13 insertions(+), 42 deletions(-) diff --git a/RELEASE-NOTES-1.18 b/RELEASE-NOTES-1.18 index e95f3c8531..4d21b36cfb 100644 --- a/RELEASE-NOTES-1.18 +++ b/RELEASE-NOTES-1.18 @@ -338,8 +338,6 @@ production. environments * (bug 14977) Fixed $wgServer detection in cases where an IPv6 address is used as the server name. -* (bug 19725) Do not list suppressed edits in the "View X deleted edits" link - if user cannot view suppressed edits. * The View X deleted revisions is now shown again on Special:Upload. * (bug 29071) mediawiki.action.watch.ajax.js should pass uselang to API. * (bug 28868) Show total pages in the subtitle of an image on the diff --git a/includes/Skin.php b/includes/Skin.php index dea428dc50..76a913bf41 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -638,9 +638,8 @@ abstract class Skin extends ContextSource { if ( $this->getUser()->isAllowed( 'deletedhistory' ) && !$this->getUser()->isBlocked() && ( $this->getTitle()->getArticleId() == 0 || $action == 'history' ) ) { + $n = $this->getTitle()->isDeleted(); - $includeSuppressed = $this->getUser()->isAllowed( 'suppressrevision' ); - $n = $this->getTitle()->isDeleted( $includeSuppressed ); if ( $n ) { if ( $this->getUser()->isAllowed( 'undelete' ) ) { diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 82d4ace368..ea6274dd97 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -951,9 +951,8 @@ class SkinTemplate extends Skin { } } else { // article doesn't exist or is deleted - if ( $user->isAllowed( 'deletedhistory' ) && !$user->isBlocked() ) { - $includeSuppressed = $user->isAllowed( 'suppressrevision' ); - $n = $title->isDeleted( $includeSuppressed ); + if ( $user->isAllowed( 'deletedhistory' ) ) { + $n = $title->isDeleted(); if( $n ) { $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); // If the user can't undelete but can view deleted history show them a "View .. deleted" tab instead diff --git a/includes/Title.php b/includes/Title.php index 5211769b8b..418740da13 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2391,37 +2391,21 @@ class Title { /** * Is there a version of this page in the deletion archive? * - * @param $includeSuppressed Boolean Include suppressed revisions? * @return Int the number of archived revisions */ - public function isDeleted( $includeSuppressed = false ) { + public function isDeleted() { if ( $this->getNamespace() < 0 ) { $n = 0; } else { $dbr = wfGetDB( DB_SLAVE ); - $conditions = array( 'ar_namespace' => $this->getNamespace(), 'ar_title' => $this->getDBkey() ); - - if( !$includeSuppressed ) { - $suppressedTextBits = Revision::DELETED_TEXT | Revision::DELETED_RESTRICTED; - $conditions[] = $dbr->bitAnd('ar_deleted', $suppressedTextBits ) . - ' != ' . $suppressedTextBits; - } $n = $dbr->selectField( 'archive', 'COUNT(*)', - $conditions, + array( 'ar_namespace' => $this->getNamespace(), 'ar_title' => $this->getDBkey() ), __METHOD__ ); if ( $this->getNamespace() == NS_FILE ) { - $fconditions = array( 'fa_name' => $this->getDBkey() ); - if( !$includeSuppressed ) { - $suppressedTextBits = File::DELETED_FILE | File::DELETED_RESTRICTED; - $fconditions[] = $dbr->bitAnd('fa_deleted', $suppressedTextBits ) . - ' != ' . $suppressedTextBits; - } - - $n += $dbr->selectField( 'filearchive', - 'COUNT(*)', - $fconditions, + $n += $dbr->selectField( 'filearchive', 'COUNT(*)', + array( 'fa_name' => $this->getDBkey() ), __METHOD__ ); } diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 2dea1a890c..702ee7c190 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -62,7 +62,6 @@ class PageArchive { * @return ResultWrapper */ public static function listPagesByPrefix( $prefix ) { - global $wgUser; $dbr = wfGetDB( DB_SLAVE ); $title = Title::newFromText( $prefix ); @@ -78,12 +77,6 @@ class PageArchive { 'ar_namespace' => $ns, 'ar_title' . $dbr->buildLike( $prefix, $dbr->anyString() ), ); - - // bug 19725 - $suppressedText = Revision::DELETED_TEXT | Revision::DELETED_RESTRICTED; - if( !$wgUser->isAllowed( 'suppressrevision' ) ) { - $conds[] = $dbr->bitAnd('ar_deleted', $suppressedText ) . - ' != ' . $suppressedText; } return self::listPages( $dbr, $conds ); } diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 0bf52ec4a2..7fd6e1e794 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -300,10 +300,9 @@ class SpecialUpload extends SpecialPage { $title = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName ); $user = $this->getUser(); // Show a subtitle link to deleted revisions (to sysops et al only) - if( $title instanceof Title && $user->isAllowed( 'deletedhistory' ) && !$user->isBlocked() ) { - $canViewSuppress = $user->isAllowed( 'suppressrevision' ); - $count = $title->isDeleted( $canViewSuppress ); - if ( $count > 0 ) { + if( $title instanceof Title ) { + $count = $title->isDeleted(); + if ( $count > 0 && $user->isAllowed( 'deletedhistory' ) ) { $link = wfMsgExt( $user->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted', array( 'parse', 'replaceafter' ), diff --git a/languages/Language.php b/languages/Language.php index a1eba5005a..c125dd25c1 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -232,7 +232,7 @@ class Language { /** * Includes language class files - * + * * @param $class Name of the language class */ public static function preloadLanguageClass( $class ) { @@ -1259,7 +1259,6 @@ class Language { - floor( ( $gy + 99 ) / 100 ) + floor( ( $gy + 399 ) / 400 ); - // Add days of the past months of this year for ( $i = 0; $i < $gm; $i++ ) { $gDayNo += self::$GREG_DAYS[$i]; @@ -3337,7 +3336,7 @@ class Language { } /** - * Get the first fallback for a given language. + * Get the first fallback for a given language. * * @param $code string * @@ -3397,7 +3396,7 @@ class Language { static function getMessageFor( $key, $code ) { return self::getLocalisationCache()->getSubitem( $code, 'messages', $key ); } - + /** * Get all message keys for a given language. This is a faster alternative to * array_keys( Language::getMessagesFor( $code ) ) -- 2.20.1