From c1f9b1f7b1b77776192048005dcc66dcf3df2bfb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 27 Dec 2014 15:41:37 +0100 Subject: Update to MediaWiki 1.24.1 --- includes/UserArrayFromResult.php | 90 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 includes/UserArrayFromResult.php (limited to 'includes/UserArrayFromResult.php') diff --git a/includes/UserArrayFromResult.php b/includes/UserArrayFromResult.php new file mode 100644 index 00000000..fb533d08 --- /dev/null +++ b/includes/UserArrayFromResult.php @@ -0,0 +1,90 @@ +res = $res; + $this->key = 0; + $this->setCurrent( $this->res->current() ); + } + + /** + * @param bool|stdClass $row + * @return void + */ + protected function setCurrent( $row ) { + if ( $row === false ) { + $this->current = false; + } else { + $this->current = User::newFromRow( $row ); + } + } + + /** + * @return int + */ + public function count() { + return $this->res->numRows(); + } + + /** + * @return User + */ + function current() { + return $this->current; + } + + function key() { + return $this->key; + } + + function next() { + $row = $this->res->next(); + $this->setCurrent( $row ); + $this->key++; + } + + function rewind() { + $this->res->rewind(); + $this->key = 0; + $this->setCurrent( $this->res->current() ); + } + + /** + * @return bool + */ + function valid() { + return $this->current !== false; + } +} -- cgit v1.2.3-54-g00ecf