* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* List for revision table items for a single page
*/
-abstract class RevisionListBase extends ContextSource {
+abstract class RevisionListBase extends ContextSource implements Iterator {
/** @var Title */
public $title;
*/
public function reset() {
if ( !$this->res ) {
- $this->res = $this->doQuery( wfGetDB( DB_SLAVE ) );
+ $this->res = $this->doQuery( wfGetDB( DB_REPLICA ) );
} else {
$this->res->rewind();
}
return $this->current;
}
+ public function rewind() {
+ $this->reset();
+ }
+
/**
* Get the current list item, or false if we are at the end
* @return Revision
return $this->current;
}
+ public function key() {
+ return $this->res ? $this->res->key(): 0;
+ }
+
+ public function valid() {
+ return $this->res ? $this->res->valid() : false;
+ }
+
/**
* Get the number of items in the list.
* @return int
* This is used to show the list in HTML form, by the special page.
*/
abstract public function getHTML();
+
+ /**
+ * Returns an instance of LinkRenderer
+ * @return \MediaWiki\Linker\LinkRenderer
+ */
+ protected function getLinkRenderer() {
+ return MediaWikiServices::getInstance()->getLinkRenderer();
+ }
}
class RevisionList extends RevisionListBase {