X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLogEvents.php;h=f89c8262064369cbb1bd48aed2a6e2fcc7c501b4;hb=a36db2e887aa6bc1dec9a52bb6003689d67daf01;hp=e3f15051cf4f13aa08296c72c03487cb5a0809a4;hpb=2c6646c7f675296380c61c9be914cc9cf8c4c4f2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index e3f15051cf..f89c826206 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -58,7 +58,7 @@ class ApiQueryLogEvents extends ApiQueryBase { $this->fld_details = isset( $prop['details'] ); $this->fld_tags = isset( $prop['tags'] ); - $hideLogs = LogEventsList::getExcludeClause( $db ); + $hideLogs = LogEventsList::getExcludeClause( $db, 'user', $this->getUser() ); if ( $hideLogs !== false ) { $this->addWhere( $hideLogs ); } @@ -70,7 +70,7 @@ class ApiQueryLogEvents extends ApiQueryBase { 'user' => array( 'JOIN', 'user_id=log_user' ), 'page' => array( 'LEFT JOIN', - array( 'log_namespace=page_namespace', + array( 'log_namespace=page_namespace', 'log_title=page_title' ) ) ) ); $index = array( 'logging' => 'times' ); // default, may change @@ -151,7 +151,7 @@ class ApiQueryLogEvents extends ApiQueryBase { if ( is_null( $title ) ) { $this->dieUsage( "Bad title value '$prefix'", 'param_prefix' ); } - $this->addWhereFld( 'log_namespace', $title->getNamespace() ); + $this->addWhereFld( 'log_namespace', $title->getNamespace() ); $this->addWhere( 'log_title ' . $db->buildLike( $title->getDBkey(), $db->anyString() ) ); } @@ -201,7 +201,7 @@ class ApiQueryLogEvents extends ApiQueryBase { public static function addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy = false ) { switch ( $type ) { case 'move': - if ( $legacy ){ + if ( $legacy ) { $targetKey = 0; $noredirKey = 1; } else { @@ -209,21 +209,21 @@ class ApiQueryLogEvents extends ApiQueryBase { $noredirKey = '5::noredir'; } - if ( isset( $params[ $targetKey ] ) ) { - $title = Title::newFromText( $params[ $targetKey ] ); + if ( isset( $params[$targetKey] ) ) { + $title = Title::newFromText( $params[$targetKey] ); if ( $title ) { $vals2 = array(); ApiQueryBase::addTitleInfo( $vals2, $title, 'new_' ); $vals[$type] = $vals2; } } - if ( isset( $params[ $noredirKey ] ) && $params[ $noredirKey ] ) { + if ( isset( $params[$noredirKey] ) && $params[$noredirKey] ) { $vals[$type]['suppressedredirect'] = ''; } $params = null; break; case 'patrol': - if ( $legacy ){ + if ( $legacy ) { $cur = 0; $prev = 1; $auto = 2; @@ -241,7 +241,12 @@ class ApiQueryLogEvents extends ApiQueryBase { break; case 'rights': $vals2 = array(); - list( $vals2['old'], $vals2['new'] ) = $params; + if( $legacy ) { + list( $vals2['old'], $vals2['new'] ) = $params; + } else { + $vals2['new'] = implode( ', ', $params['5::newgroups'] ); + $vals2['old'] = implode( ', ', $params['4::oldgroups'] ); + } $vals[$type] = $vals2; $params = null; break; @@ -262,8 +267,19 @@ class ApiQueryLogEvents extends ApiQueryBase { break; } if ( !is_null( $params ) ) { - $result->setIndexedTagName_recursive( $params, 'param' ); - $vals = array_merge( $vals, $params ); + $logParams = array(); + // Keys like "4::paramname" can't be used for output so we change them to "paramname" + foreach ( $params as $key => $value ) { + if ( strpos( $key, ':' ) === false ) { + $logParams[$key] = $value; + continue; + } + $logParam = explode( ':', $key, 3 ); + $logParams[$logParam[2]] = $value; + } + $result->setIndexedTagName( $logParams, 'param' ); + $result->setIndexedTagName_recursive( $logParams, 'param' ); + $vals = array_merge( $vals, $logParams ); } return $vals; } @@ -361,8 +377,12 @@ class ApiQueryLogEvents extends ApiQueryBase { if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) { // formatComment() calls wfMessage() among other things return 'anon-public-user-private'; - } else { + } elseif ( LogEventsList::getExcludeClause( $this->getDB(), 'user', $this->getUser() ) + === LogEventsList::getExcludeClause( $this->getDB(), 'public' ) + ) { // Output can only contain public data. return 'public'; + } else { + return 'anon-public-user-private'; } } @@ -525,8 +545,4 @@ class ApiQueryLogEvents extends ApiQueryBase { public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/API:Logevents'; } - - public function getVersion() { - return __CLASS__ . ': $Id$'; - } }