X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryUserContributions.php;h=9ad77d4860dc93688d959cf65a12a4e4c4989b82;hb=2dfbd7761a1b8f293a3b6856e94217d8472a5da8;hp=b492d9a326c4a8528f03f345df5007b7148d5b6a;hpb=194d5d6bcfd6429037f0f66c5f359083cb13b994;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index b492d9a326..9ad77d4860 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -207,10 +207,16 @@ class ApiQueryContributions extends ApiQueryBase { $this->addWhereFld( 'page_namespace', $this->params['namespace'] ); $show = $this->params['show']; + if ( $this->params['toponly'] ) { // deprecated/old param + $show[] = 'top'; + } if ( !is_null( $show ) ) { $show = array_flip( $show ); + if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) ) || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) ) + || ( isset( $show['top'] ) && isset( $show['!top'] ) ) + || ( isset( $show['new'] ) && isset( $show['!new'] ) ) ) { $this->dieUsageMsg( 'show' ); } @@ -219,6 +225,10 @@ class ApiQueryContributions extends ApiQueryBase { $this->addWhereIf( 'rev_minor_edit != 0', isset( $show['minor'] ) ); $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) ); $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) ); + $this->addWhereIf( 'rev_id != page_latest', isset( $show['!top'] ) ); + $this->addWhereIf( 'rev_id = page_latest', isset( $show['top'] ) ); + $this->addWhereIf( 'rev_parent_id != 0', isset( $show['!new'] ) ); + $this->addWhereIf( 'rev_parent_id = 0', isset( $show['new'] ) ); } $this->addOption( 'LIMIT', $this->params['limit'] + 1 ); $index = array( 'revision' => 'usertext_timestamp' ); @@ -294,10 +304,6 @@ class ApiQueryContributions extends ApiQueryBase { $this->addWhereFld( 'ct_tag', $this->params['tag'] ); } - if ( $this->params['toponly'] ) { - $this->addWhere( 'rev_id = page_latest' ); - } - $this->addOption( 'USE INDEX', $index ); } @@ -477,10 +483,17 @@ class ApiQueryContributions extends ApiQueryBase { '!minor', 'patrolled', '!patrolled', + 'top', + '!top', + 'new', + '!new', ) ), 'tag' => null, - 'toponly' => false, + 'toponly' => array( + ApiBase::PARAM_DFLT => false, + ApiBase::PARAM_DEPRECATED => true, + ), ); }