From: Sam Reed Date: Sun, 31 Jan 2010 20:59:50 +0000 (+0000) Subject: bug 18427 - Parsed comment on prop=revision X-Git-Tag: 1.31.0-rc.0~38014 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=c5ad4b031f90b15c9d23326d5106cb2261940acc;p=lhc%2Fweb%2Fwiklou.git bug 18427 - Parsed comment on prop=revision --- diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 7106641dd2..9a98e7d4a1 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -42,7 +42,7 @@ class ApiQueryRevisions extends ApiQueryBase { } private $fld_ids = false, $fld_flags = false, $fld_timestamp = false, $fld_size = false, - $fld_comment = false, $fld_user = false, $fld_content = false, $fld_tags = false; + $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_content = false, $fld_tags = false; protected function getTokenFunctions() { // tokenname => function @@ -137,6 +137,7 @@ class ApiQueryRevisions extends ApiQueryBase { $this->fld_flags = isset ( $prop['flags'] ); $this->fld_timestamp = isset ( $prop['timestamp'] ); $this->fld_comment = isset ( $prop['comment'] ); + $this->fld_parsedcomment = isset ( $prop['parsedcomment'] ); $this->fld_size = isset ( $prop['size'] ); $this->fld_user = isset ( $prop['user'] ); $this->token = $params['token']; @@ -359,13 +360,21 @@ class ApiQueryRevisions extends ApiQueryBase { $vals['size'] = intval( $revision->getSize() ); } - if ( $this->fld_comment ) { + if ( $this->fld_comment || $this->fld_parsedcomment ) { if ( $revision->isDeleted( Revision::DELETED_COMMENT ) ) { $vals['commenthidden'] = ''; } else { $comment = $revision->getComment(); if ( strval( $comment ) !== '' ) - $vals['comment'] = $comment; + { + if ( $this->fld_comment ) + $vals['comment'] = $comment; + + if ( $this->fld_parsedcomment ) { + global $wgUser; + $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $comment, $title ); + } + } } } @@ -461,6 +470,7 @@ class ApiQueryRevisions extends ApiQueryBase { 'user', 'size', 'comment', + 'parsedcomment', 'content', 'tags' )