Wikimedia
(NewsletterStore|NewsletterDb)::(addSubscription|removeSubscription) should take in an array of user_ids
This task is about the Newsletter Extension.
Currently, the functions has a signature of:
public function removeSubscription( Newsletter $newsletter, User $user ) {
// Get the $user->id and insert to db (strange and slow)
}
which actually takes in the user parameter as a User
object. This is costly at some point (as we will shortly have multiple users getting added manually via the subscribers edit functionality soon). This task requires:
Make the functions accept in an integer array of user_ids, and use it directly to insert it to db
Make sure the existing user subscribtion and unsubscribe feature work (Right now its directly sending in $this->getUser()
to these functions. This should be changed, and maybe just $this->getUser()->getId();
should be passed`
Make sure the bulk addition and removal of subscribers via Special:Newsletter/id/subscribers
too work, by changing them to call the above functions with an array of userids.
Reedy's original comment:
It'd be really useful if the functions above took an array of users (or, we add another function), and could be used to add N subscribers in one SQL query, rather than N SQL queries
Much better performance wise
Fixes a TODO in https://gerrit.wikimedia.org/r/#/c/329055/6/includes/specials/SpecialNewsletter.php Reedy> "Improve function definition, update callers"
Task tags
Students who completed this task
Filip