MediaWiki REL1_35
|
Go to the source code of this file.
Functions | |
getExpiryFromParams (array $params) | |
Get formatted expiry from the given parameters, or null if no expiry was provided. | |
getWatchlistExpiry (WatchedItemStoreInterface $store, Title $title, User $user) | |
Get existing expiry from the database. | |
getWatchlistParams (array $watchOptions=[]) | |
Get additional allow params specific to watchlisting. | |
getWatchlistValue (string $watchlist, Title $title, User $user, ?string $userOption=null) | |
Return true if we're to watch the page, false if not. | |
setWatch (string $watch, Title $title, User $user, ?string $userOption=null, ?string $expiry=null) | |
Set a watch (or unwatch) based the based on a watchlist parameter. | |
Variables | |
string | $watchlistMaxDuration |
Relative maximum expiry. | |
trait | ApiWatchlistTrait |
An ApiWatchlistTrait adds class properties and convenience methods for APIs that allow you to watch a page. | |
|
protected |
Get formatted expiry from the given parameters, or null if no expiry was provided.
array | $params | Request parameters passed to the API. |
Definition at line 135 of file ApiWatchlistTrait.php.
Referenced by ApiDelete\execute(), ApiEditPage\execute(), ApiMove\execute(), ApiProtect\execute(), ApiRollback\execute(), ApiUndelete\execute(), and ApiUpload\performUpload().
|
protected |
Get existing expiry from the database.
WatchedItemStoreInterface | $store | |
Title | $title | |
User | $user | The user to get the expiry for. |
Definition at line 152 of file ApiWatchlistTrait.php.
Referenced by ApiEditPage\execute(), and ChangesList\getArticleLink().
|
protected |
Get additional allow params specific to watchlisting.
This should be merged in with the result of self::getAllowedParams().
This purposefully does not include the deprecated 'watch' and 'unwatch' parameters that some APIs still accept.
string[] | $watchOptions |
Definition at line 35 of file ApiWatchlistTrait.php.
Referenced by ApiDelete\getAllowedParams(), ApiEditPage\getAllowedParams(), ApiMove\getAllowedParams(), ApiProtect\getAllowedParams(), ApiRollback\getAllowedParams(), ApiUndelete\getAllowedParams(), and ApiUpload\getAllowedParams().
|
protected |
Return true if we're to watch the page, false if not.
string | $watchlist | Valid values: 'watch', 'unwatch', 'preferences', 'nochange' |
Title | $title | The page under consideration |
User | $user | The user get the the value for. |
string | null | $userOption | The user option to consider when $watchlist=preferences. If not set will use watchdefault always and watchcreations if $title doesn't exist. |
Definition at line 92 of file ApiWatchlistTrait.php.
References $title, and User\getBoolOption().
Referenced by ApiEditPage\execute(), and ApiUpload\performUpload().
|
protected |
Set a watch (or unwatch) based the based on a watchlist parameter.
string | $watch | Valid values: 'watch', 'unwatch', 'preferences', 'nochange' |
Title | $title | The article's title to change |
User | $user | The user to set watch/unwatch for |
string | null | $userOption | The user option to consider when $watch=preferences |
string | null | $expiry | Optional expiry timestamp in any format acceptable to wfTimestamp(), null will not create expiries, or leave them unchanged should they already exist. |
Definition at line 72 of file ApiWatchlistTrait.php.
Referenced by ApiDelete\execute(), ApiMove\execute(), ApiProtect\execute(), ApiRollback\execute(), and ApiUndelete\execute().
|
private |
Relative maximum expiry.
Definition at line 23 of file ApiWatchlistTrait.php.