X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLogEvents.php;h=3cdc53caf2bdd3c526799e84f30874ee4359d387;hb=4d1d9f65021c60eccb1295a13565d8d7fd926966;hp=d3607e111c999ccc640afb56d65130200188c435;hpb=04d7d46b1d39340121698ba76fd8e433f60929c9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index d3607e111c..3cdc53caf2 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -36,7 +36,7 @@ class ApiQueryLogEvents extends ApiQueryBase { } private $fld_ids = false, $fld_title = false, $fld_type = false, - $fld_action = false, $fld_user = false, $fld_userid = false, + $fld_user = false, $fld_userid = false, $fld_timestamp = false, $fld_comment = false, $fld_parsedcomment = false, $fld_details = false, $fld_tags = false; @@ -50,7 +50,6 @@ class ApiQueryLogEvents extends ApiQueryBase { $this->fld_ids = isset( $prop['ids'] ); $this->fld_title = isset( $prop['title'] ); $this->fld_type = isset( $prop['type'] ); - $this->fld_action = isset( $prop['action'] ); $this->fld_user = isset( $prop['user'] ); $this->fld_userid = isset( $prop['userid'] ); $this->fld_timestamp = isset( $prop['timestamp'] ); @@ -312,7 +311,8 @@ class ApiQueryLogEvents extends ApiQueryBase { break; } $vals2 = array(); - list( $vals2['duration'], $vals2['flags'] ) = $params; + $vals2['duration'] = $params[0]; + $vals2['flags'] = isset( $params[1] ) ? $params[1] : ''; // Indefinite blocks have no expiry time if ( SpecialBlock::parseExpiryInput( $params[0] ) !== wfGetDB( DB_SLAVE )->getInfinity() ) { @@ -327,6 +327,17 @@ class ApiQueryLogEvents extends ApiQueryBase { $params['img_timestamp'] = wfTimestamp( TS_ISO_8601, $params['img_timestamp'] ); } break; + case 'merge': + // replace the named parameter with numbered for backward compatibility + if ( isset( $params['4::dest'] ) ) { + $params[] = $params['4::dest']; + unset( $params['4::dest'] ); + } + if ( isset( $params['5::mergepoint'] ) ) { + $params[] = $params['5::mergepoint']; + unset( $params['5::mergepoint'] ); + } + break; } if ( !is_null( $params ) ) { $logParams = array(); @@ -388,7 +399,7 @@ class ApiQueryLogEvents extends ApiQueryBase { } } - if ( $this->fld_type || $this->fld_action ) { + if ( $this->fld_type ) { $vals['type'] = $row->log_type; $vals['action'] = $row->log_action; } @@ -474,7 +485,7 @@ class ApiQueryLogEvents extends ApiQueryBase { public function getAllowedParams( $flags = 0 ) { $config = $this->getConfig(); - return array( + $ret = array( 'prop' => array( ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_DFLT => 'ids|title|type|user|timestamp|comment|details', @@ -511,14 +522,15 @@ class ApiQueryLogEvents extends ApiQueryBase { ApiBase::PARAM_TYPE => array( 'newer', 'older' - ) + ), + ApiBase::PARAM_HELP_MSG => 'api-help-param-direction', ), 'user' => null, 'title' => null, 'namespace' => array( ApiBase::PARAM_TYPE => 'namespace' ), - 'prefix' => null, + 'prefix' => array(), 'tag' => null, 'limit' => array( ApiBase::PARAM_DFLT => 10, @@ -527,52 +539,22 @@ class ApiQueryLogEvents extends ApiQueryBase { ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 ), - 'continue' => null, - ); - } - - public function getParamDescription() { - $p = $this->getModulePrefix(); - - return array( - 'prop' => array( - 'Which properties to get', - ' ids - Adds the ID of the log event', - ' title - Adds the title of the page for the log event', - ' type - Adds the type of log event', - ' user - Adds the user responsible for the log event', - ' userid - Adds the user ID who was responsible for the log event', - ' timestamp - Adds the timestamp for the event', - ' comment - Adds the comment of the event', - ' parsedcomment - Adds the parsed comment of the event', - ' details - Lists additional details about the event', - ' tags - Lists tags for the event', - ), - 'type' => 'Filter log entries to only this type', - 'action' => array( - "Filter log actions to only this action. Overrides {$p}type", - "Wildcard actions like 'action/*' allows to specify any string for the asterisk" + 'continue' => array( + ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', ), - 'start' => 'The timestamp to start enumerating from', - 'end' => 'The timestamp to end enumerating', - 'dir' => $this->getDirectionDescription( $p ), - 'user' => 'Filter entries to those made by the given user', - 'title' => 'Filter entries to those related to a page', - 'namespace' => 'Filter entries to those in the given namespace', - 'prefix' => 'Filter entries that start with this prefix. Disabled in Miser Mode', - 'limit' => 'How many total event entries to return', - 'tag' => 'Only list event entries tagged with this tag', - 'continue' => 'When more results are available, use this to continue', ); - } - public function getDescription() { - return 'Get events from logs.'; + if ( $config->get( 'MiserMode' ) ) { + $ret['prefix'][ApiBase::PARAM_HELP_MSG] = 'api-help-param-disabled-in-miser-mode'; + } + + return $ret; } - public function getExamples() { + protected function getExamplesMessages() { return array( - 'api.php?action=query&list=logevents' + 'action=query&list=logevents' + => 'apihelp-query+logevents-example-simple', ); }