Wikibase
MediaWiki Wikibase extension
Wikibase\Client\Usage\Sql\SqlSubscriptionManager Class Reference

SubscriptionManager implementation backed by an SQL table. More...

+ Inheritance diagram for Wikibase\Client\Usage\Sql\SqlSubscriptionManager:
+ Collaboration diagram for Wikibase\Client\Usage\Sql\SqlSubscriptionManager:

Public Member Functions

 __construct (SessionConsistentConnectionManager $connectionManager)
 
 subscribe ( $subscriber, array $entityIds)
 
 unsubscribe ( $subscriber, array $entityIds)
 

Private Member Functions

 idsToString (array $entityIds)
 
 querySubscriptions (IDatabase $db, $subscriber, array $subscriptions)
 For a set of potential subscriptions, returns the existing subscriptions. More...
 
 insertSubscriptions (IDatabase $db, $subscriber, array $subscriptions)
 Inserts a set of subscriptions. More...
 
 deleteSubscriptions (IDatabase $db, $subscriber, array $subscriptions)
 Inserts a set of subscriptions. More...
 
 makeSubscriptionRows ( $subscriber, array $subscriptions)
 Returns a list of rows for insertion, using IDatabase's multi-row insert mechanism. More...
 

Private Attributes

 $connectionManager
 

Detailed Description

SubscriptionManager implementation backed by an SQL table.

See also
docs/usagetracking.wiki
Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::__construct ( SessionConsistentConnectionManager  $connectionManager)

Member Function Documentation

◆ deleteSubscriptions()

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::deleteSubscriptions ( IDatabase  $db,
  $subscriber,
array  $subscriptions 
)
private

Inserts a set of subscriptions.

Parameters
IDatabase$db
string$subscriber
string[]$subscriptions

◆ idsToString()

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::idsToString ( array  $entityIds)
private
Parameters
EntityId[]$entityIds
Returns
string[]

◆ insertSubscriptions()

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::insertSubscriptions ( IDatabase  $db,
  $subscriber,
array  $subscriptions 
)
private

Inserts a set of subscriptions.

Parameters
IDatabase$db
string$subscriber
string[]$subscriptions

◆ makeSubscriptionRows()

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::makeSubscriptionRows (   $subscriber,
array  $subscriptions 
)
private

Returns a list of rows for insertion, using IDatabase's multi-row insert mechanism.

Each row is represented as [ $subscriber, $entityId ].

Parameters
string$subscriber
string[]$subscriptions
Returns
array[] rows

◆ querySubscriptions()

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::querySubscriptions ( IDatabase  $db,
  $subscriber,
array  $subscriptions 
)
private

For a set of potential subscriptions, returns the existing subscriptions.

Parameters
IDatabase$db
string$subscriber
string[]$subscriptions
Returns
string[] Entity ID strings from $subscriptions which $subscriber is already subscribed to.

◆ subscribe()

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::subscribe (   $subscriber,
array  $entityIds 
)
See also
SubscriptionManager::subscribe
Parameters
string$subscriber
EntityId[]$entityIds
Exceptions
InvalidArgumentException
Exception

Implements Wikibase\Client\Usage\SubscriptionManager.

◆ unsubscribe()

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::unsubscribe (   $subscriber,
array  $entityIds 
)
See also
SubscriptionManager::unsubscribe
Parameters
string$subscriberGlobal site ID of the client
EntityId[]$entityIdsThe entities to subscribe to.
Exceptions
InvalidArgumentException
Exception

Implements Wikibase\Client\Usage\SubscriptionManager.

Member Data Documentation

◆ $connectionManager

Wikibase\Client\Usage\Sql\SqlSubscriptionManager::$connectionManager
private

The documentation for this class was generated from the following file: