summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Echo/includes/EchoContainmentSet.php')
-rw-r--r--Echo/includes/EchoContainmentSet.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/Echo/includes/EchoContainmentSet.php b/Echo/includes/EchoContainmentSet.php
index 986379c3..2f79634e 100644
--- a/Echo/includes/EchoContainmentSet.php
+++ b/Echo/includes/EchoContainmentSet.php
@@ -67,18 +67,38 @@ class EchoContainmentSet {
}
/**
+ * Add a list of title IDs from a user preference to the set of lists
+ * checked by self::contains().
+ *
+ * @param string $preferenceName
+ */
+ public function addTitleIDsFromUserOption( string $preferenceName ) :void {
+ $preference = $this->recipient->getOption( $preferenceName, [] );
+ if ( !is_string( $preference ) ) {
+ // We expect the preference data to be saved as a string via the
+ // preferences form; if the user modified their data so it's no
+ // longer a string, ignore it.
+ return;
+ }
+ $titleIDs = preg_split( '/\n/', $preference, -1, PREG_SPLIT_NO_EMPTY );
+ $this->addArray( $titleIDs );
+ }
+
+ /**
* Add a list from a wiki page to the set of lists checked by self::contains(). Data
* from wiki pages is cached via the BagOStuff. Caching is disabled when passing a null
* $cache object.
*
* @param int $namespace An NS_* constant representing the mediawiki namespace of the page containing the list.
* @param string $title The title of the page containing the list.
- * @param BagOStuff|null $cache An object to cache the page with or null for no cache.
+ * @param WANObjectCache|null $cache An object to cache the page with or null for no cache.
* @param string $cacheKeyPrefix A prefix to be combined with the pages latest revision id and used as a cache key.
*
* @throws MWException
*/
- public function addOnWiki( $namespace, $title, BagOStuff $cache = null, $cacheKeyPrefix = '' ) {
+ public function addOnWiki(
+ $namespace, $title, WANObjectCache $cache = null, $cacheKeyPrefix = ''
+ ) {
$list = new EchoOnWikiList( $namespace, $title );
if ( $cache ) {
if ( $cacheKeyPrefix === '' ) {