mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-11 07:26:29 +00:00
1667e25854
The new locateUsersWatchingTitle implementation could end up returning thousands of users, currently on enwiki there are 25 titles with more than 10k subscribed users and aprox 550 titles with more than 1k subscribed users. This switches the user collection to an iterator based implementation so that we no longer need to have the entire users list at any one time. Change-Id: I3d3fa9328f348bb48682d3658622952ce82d3925
18 lines
401 B
PHP
18 lines
401 B
PHP
<?php
|
|
|
|
/**
|
|
* Applies a callback to all values returned from the iterator
|
|
*/
|
|
class EchoCallbackIterator extends EchoIteratorDecorator {
|
|
protected $callable;
|
|
|
|
public function __construct( Iterator $iterator, $callable ) {
|
|
parent::__construct( $iterator );
|
|
$this->callable = $callable;
|
|
}
|
|
|
|
public function current() {
|
|
return call_user_func( $this->callable, $this->iterator->current() );
|
|
}
|
|
}
|