2017-09-27 17:53:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class CommentLatestIdAPI extends ApiBase {
|
|
|
|
|
|
|
|
public function execute() {
|
2019-05-25 13:18:39 +02:00
|
|
|
// To avoid API warning, register the parameter used to bust browser cache
|
|
|
|
$this->getMain()->getVal( '_' );
|
|
|
|
|
2017-09-27 17:53:26 +02:00
|
|
|
$pageID = $this->getMain()->getVal( 'pageID' );
|
|
|
|
|
|
|
|
$commentsPage = new CommentsPage( $pageID, RequestContext::getMain() );
|
|
|
|
|
|
|
|
$result = $this->getResult();
|
|
|
|
$result->addValue( $this->getModuleName(), 'id', $commentsPage->getLatestCommentID() );
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAllowedParams() {
|
2019-05-25 13:18:39 +02:00
|
|
|
return [
|
|
|
|
'pageID' => [
|
2017-09-27 17:53:26 +02:00
|
|
|
ApiBase::PARAM_REQUIRED => true,
|
2019-05-25 13:18:39 +02:00
|
|
|
ApiBase::PARAM_TYPE => 'integer'
|
|
|
|
]
|
|
|
|
];
|
2017-09-27 17:53:26 +02:00
|
|
|
}
|
|
|
|
}
|