X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRevisions.php;h=1a5ad174dfdadff3e88d379bc362a6ffa9b9ad46;hb=02cbd1752949d4b406c70d2aca848bfb16d9fb30;hp=739054649244b62821b13923998ac66812cbab13;hpb=f34f7bfd56ac92a53b9d5687cf51293908272ed5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 7390546492..1a5ad174df 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -224,6 +224,13 @@ class ApiQueryRevisions extends ApiQueryBase { } } + // add user name, if needed + if ( $this->fld_user ) { + $this->addTables( 'user' ); + $this->addJoinConds( array( 'user' => Revision::userJoinCond() ) ); + $this->addFields( Revision::selectUserFields() ); + } + // Bug 24166 - API error when using rvprop=tags $this->addTables( 'revision' ); @@ -290,7 +297,7 @@ class ApiQueryRevisions extends ApiQueryBase { $this->addWhereFld( 'rev_id', array_keys( $revs ) ); if ( !is_null( $params['continue'] ) ) { - $this->addWhere( "rev_id >= '" . intval( $params['continue'] ) . "'" ); + $this->addWhere( 'rev_id >= ' . intval( $params['continue'] ) ); } $this->addOption( 'ORDER BY', 'rev_id' ); @@ -322,9 +329,9 @@ class ApiQueryRevisions extends ApiQueryBase { $pageid = intval( $cont[0] ); $revid = intval( $cont[1] ); $this->addWhere( - "rev_page > '$pageid' OR " . - "(rev_page = '$pageid' AND " . - "rev_id >= '$revid')" + "rev_page > $pageid OR " . + "(rev_page = $pageid AND " . + "rev_id >= $revid)" ); } $this->addOption( 'ORDER BY', array( @@ -641,6 +648,66 @@ class ApiQueryRevisions extends ApiQueryBase { ); } + public function getResultProperties() { + $props = array( + '' => array(), + 'ids' => array( + 'revid' => 'integer', + 'parentid' => array( + ApiBase::PROP_TYPE => 'integer', + ApiBase::PROP_NULLABLE => true + ) + ), + 'flags' => array( + 'minor' => 'boolean' + ), + 'user' => array( + 'userhidden' => 'boolean', + 'user' => 'string', + 'anon' => 'boolean' + ), + 'userid' => array( + 'userhidden' => 'boolean', + 'userid' => 'integer', + 'anon' => 'boolean' + ), + 'timestamp' => array( + 'timestamp' => 'timestamp' + ), + 'size' => array( + 'size' => 'integer' + ), + 'sha1' => array( + 'sha1' => 'string' + ), + 'comment' => array( + 'commenthidden' => 'boolean', + 'comment' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ) + ), + 'parsedcomment' => array( + 'commenthidden' => 'boolean', + 'parsedcomment' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ) + ), + 'content' => array( + '*' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ), + 'texthidden' => 'boolean' + ) + ); + + self::addTokenProperties( $props, $this->getTokenFunctions() ); + + return $props; + } + public function getDescription() { return array( 'Get revision information',