X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flogging%2FLogPager.php;h=256934e4c7cc121f9c723f966bf873f2ac9f4ff9;hb=50cb6c038101d0b7c1f1b02a8f219ebdf2bbdd85;hp=399c7993ff51d5e3a2cc7cadab51e4834f471c59;hpb=ca895b7072b9d98a5b3abf8f2a46474095c16210;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index 399c7993ff..256934e4c7 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -175,7 +175,7 @@ class LogPager extends ReverseChronologicalPager { $user = $this->getUser(); if ( !$user->isAllowed( 'deletedhistory' ) ) { $this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::DELETED_USER ) . ' = 0'; - } elseif ( !$user->isAllowed( 'suppressrevision' ) ) { + } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) { $this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::SUPPRESSED_USER ) . ' != ' . LogPage::SUPPRESSED_USER; } @@ -207,6 +207,18 @@ class LogPager extends ReverseChronologicalPager { $ns = $title->getNamespace(); $db = $this->mDb; + $doUserRightsLogLike = false; + if ( $this->types == array( 'rights' ) ) { + global $wgUserrightsInterwikiDelimiter; + $parts = explode( $wgUserrightsInterwikiDelimiter, $title->getDBKey() ); + if ( count( $parts ) == 2 ) { + list( $name, $database ) = array_map( 'trim', $parts ); + if ( strstr( $database, '*' ) ) { // Search for wildcard in database name + $doUserRightsLogLike = true; + } + } + } + # Using the (log_namespace, log_title, log_timestamp) index with a # range scan (LIKE) on the first two parts, instead of simple equality, # makes it unusable for sorting. Sorted retrieval using another index @@ -218,12 +230,19 @@ class LogPager extends ReverseChronologicalPager { # use the page_time index. That should have no more than a few hundred # log entries for even the busiest pages, so it can be safely scanned # in full to satisfy an impossible condition on user or similar. - if ( $pattern && !$wgMiserMode ) { - $this->mConds['log_namespace'] = $ns; - $this->mConds[] = 'log_title ' . $db->buildLike( $title->getDBkey(), $db->anyString() ); + $this->mConds['log_namespace'] = $ns; + if ( $doUserRightsLogLike ) { + $params = array( $name . $wgUserrightsInterwikiDelimiter ); + foreach ( explode( '*', $database ) as $databasepart ) { + $params[] = $databasepart; + $params[] = $db->anyString(); + } + array_pop( $params ); // Get rid of the last % we added. + $this->mConds[] = 'log_title' . $db->buildLike( $params ); + } elseif ( $pattern && !$wgMiserMode ) { + $this->mConds[] = 'log_title' . $db->buildLike( $title->getDBkey(), $db->anyString() ); $this->pattern = $pattern; } else { - $this->mConds['log_namespace'] = $ns; $this->mConds['log_title'] = $title->getDBkey(); } // Paranoia: avoid brute force searches (bug 17342)