public function execute() { global $wgUser; // Before doing anything at all, let's check permissions if (!$wgUser->isAllowed('codereview-use')) { $this->dieUsage('You don\'t have permission to view code comments', 'permissiondenied'); } $params = $this->extractRequestParams(); $this->props = array_flip($params['prop']); if (isset($this->props['revision'])) { $this->setWarning('ccprop=revision has been deprecated in favor of ccprop=status'); } $listview = new CodeCommentsListView($params['repo']); if (is_null($listview->getRepo())) { $this->dieUsage("Invalid repo ``{$params['repo']}''", 'invalidrepo'); } $pager = $listview->getPager(); if (!is_null($params['start'])) { $pager->setOffset($this->getDB()->timestamp($params['start'])); } $limit = $params['limit']; $pager->setLimit($limit); $pager->doQuery(); $comments = $pager->getResult(); $data = array(); $count = 0; $lastTimestamp = 0; foreach ($comments as $row) { if ($count == $limit) { $this->setContinueEnumParameter('start', wfTimestamp(TS_ISO_8601, $lastTimestamp)); break; } $data[] = $this->formatRow($row); $lastTimestamp = $row->cc_timestamp; $count++; } $comments->free(); $result = $this->getResult(); $result->setIndexedTagName($data, 'comment'); $result->addValue('query', $this->getModuleName(), $data); }
function __construct($repo, $author) { parent::__construct($repo); $this->mAuthor = $author; }