BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
FlaggedRevs Class Reference

Static Public Member Functions

static binaryFlagging ()
 
static binaryTagName ()
 
static qualityVersions ()
 
static pristineVersions ()
 
static highestReviewTier ()
 
static autoReviewEdits ()
 
static autoReviewNewPages ()
 
static autoReviewEnabled ()
 
static maxAutoReviewLevel ($tag)
 
static isStableShownByDefault ()
 
static useOnlyIfProtected ()
 
static useSimpleConfig ()
 
static inclusionSetting ()
 
static lowProfileUI ()
 
static useProtectionLevels ()
 
static getRestrictionLevels ()
 
static getDimensions ()
 
static getTags ()
 
static getTagRestrictions ()
 
static getTagMsg ($tag)
 
static getTagLevels ($tag)
 
static getTagValueMsg ($tag, $value)
 
static dimensionsEmpty ()
 
static getQualityLevelText ($level)
 
static diffOnlyCGI ()
 
static tagIsValid ($tag, $value)
 
static flagsAreValid (array $flags)
 
static userCanSetTag ($user, $tag, $value)
 
static userCanSetFlags ($user, array $flags, $oldflags=[])
 
static userCanSetAutoreviewLevel ($user, $right)
 
static parseStableRevisionPooled (FlaggedRevision $frev, ParserOptions $pOpts)
 
static parseStableRevision (FlaggedRevision $frev, ParserOptions $pOpts)
 
static stableVersionUpdates ($page, $sv=null, $oldSv=null, $editInfo=null)
 
static clearTrackingRows ($pageId)
 
static updateStableOnlyDeps (Page $article, ParserOutput $stableOut, $mode)
 
static clearStableOnlyDeps ($pageId)
 
static purgeSquid (Title $title)
 
static HTMLCacheUpdates (Title $title)
 
static extraHTMLCacheUpdate (Title $title)
 
static markRevisionPatrolled (Revision $rev)
 
static makeMemcObj ($val)
 
static getMemcValue ($data, Page $article, $allowStale= '')
 
static isChecked (array $flags)
 
static isQuality (array $flags)
 
static isPristine (array $flags)
 
static getQualityTier (array $flags, $default=-1)
 
static quickTags ($tier)
 
static getAutoReviewTags ($user, array $oldFlags)
 
static getReviewNamespaces ()
 
static inReviewNamespace (Title $title)
 
static autoReviewEdit (WikiPage $article, $user, Revision $rev, array $flags=null, $auto=true)
 
static getJSTagParams ()
 

Static Protected Member Functions

static load ()
 
static tagsAtLevel (array $flags, $reqFlagLevels)
 

Static Protected Attributes

static $dimensions = []
 
static $minSL = []
 
static $minQL = []
 
static $minPL = []
 
static $qualityVersions = false
 
static $pristineVersions = false
 
static $tagRestrictions = []
 
static $binaryFlagging = true
 
static $reviewNamespaces = []
 
static $restrictionLevels = []
 
static $autoReviewConfig = 0
 
static $loaded = false
 

Detailed Description

Class containing utility functions for a FlaggedRevs environment

Class is lazily-initialized, calling load() as needed

Member Function Documentation

static FlaggedRevs::autoReviewEdit ( WikiPage  $article,
  $user,
Revision  $rev,
array  $flags = null,
  $auto = true 
)
static

Automatically review an revision and add a log entry in the review log.

This is called during edit operations after the new revision is added and the page tables updated, but before LinksUpdate is called.

$auto is here for revisions checked off to be reviewed. Auto-review triggers on edit, but we don't want those to count as just automatic. This also makes it so the user's name shows up in the page history.

If $flags is given, then they will be the review tags. If not, the one from the stable version will be used or minimal tags if that's not possible. If no appropriate tags can be found, then the review will abort.

static FlaggedRevs::autoReviewEdits ( )
static

Allow auto-review edits directly to the stable version by reviewers?

Returns
bool
static FlaggedRevs::autoReviewEnabled ( )
static

Auto-review of new pages or edits to pages enabled?

Returns
bool
static FlaggedRevs::autoReviewNewPages ( )
static

Auto-review new pages with the minimal level?

Returns
bool
static FlaggedRevs::binaryFlagging ( )
static

Is there only one tag and it has only one level?

Returns
bool
static FlaggedRevs::binaryTagName ( )
static

If there only one tag and it has only one level, return it

Returns
string
static FlaggedRevs::clearStableOnlyDeps (   $pageId)
static

Clear tracking table of stable-only links for this page

Parameters
int | array$pageId(int or array)
static FlaggedRevs::clearTrackingRows (   $pageId)
static

Clear FlaggedRevs tracking tables for this page

Parameters
int | array$pageId(int or array)
static FlaggedRevs::diffOnlyCGI ( )
static

Get the 'diffonly=' value for diff URLs. Either ('1','0','')

Returns
array
static FlaggedRevs::dimensionsEmpty ( )
static

Are there no actual dimensions?

Returns
bool
static FlaggedRevs::extraHTMLCacheUpdate ( Title  $title)
static

Invalidates/purges pages where only stable version includes this page.

Parameters
Title$title
static FlaggedRevs::flagsAreValid ( array  $flags)
static

Check if all of the required site flags have a valid value

Parameters
array$flags
Returns
bool
static FlaggedRevs::getAutoReviewTags (   $user,
array  $oldFlags 
)
static

Get minimum tags that are closest to $oldFlags given the site, page, and user rights limitations.

Parameters
User$user
array$oldFlagsprevious stable rev flags
Returns
mixed array or null
static FlaggedRevs::getDimensions ( )
static

Get the array of tag dimensions and level messages

Returns
array
static FlaggedRevs::getJSTagParams ( )
static

Get JS script params

static FlaggedRevs::getMemcValue (   $data,
Page  $article,
  $allowStale = '' 
)
static

Return memc value if not expired

Parameters
object | bool$datamakeMemcObj() tuple
Page$article
string$allowStaleUse 'allowStale' to skip page_touched check
Returns
mixed
static FlaggedRevs::getQualityLevelText (   $level)
static

Get corresponding text for the api output of flagging levels

Parameters
int$level
Returns
string
static FlaggedRevs::getQualityTier ( array  $flags,
  $default = -1 
)
static

Get the quality tier of review flags

Parameters
array$flags
int$defaultReturn value if one of the tags has value < 0
Returns
int flagging tier (FR_PRISTINE,FR_QUALITY,FR_CHECKED,-1)
static FlaggedRevs::getRestrictionLevels ( )
static

Get the autoreview restriction levels available

Returns
array
static FlaggedRevs::getReviewNamespaces ( )
static

Get the list of reviewable namespaces

Returns
array
static FlaggedRevs::getTagLevels (   $tag)
static

Get the levels for a tag. Gives map of level to message name.

Parameters
string$tag
Returns
associative array (integer -> string)
static FlaggedRevs::getTagMsg (   $tag)
static

Get the UI name for a tag

Parameters
string$tag
Returns
string
static FlaggedRevs::getTagRestrictions ( )
static

Get the associative array of tag restrictions (tags => [rights => levels])

Returns
array
static FlaggedRevs::getTags ( )
static

Get the associative array of tag dimensions (tags => [levels => msgkey])

Returns
array
static FlaggedRevs::getTagValueMsg (   $tag,
  $value 
)
static

Get the the UI name for a value of a tag

Parameters
string$tag
int$value
Returns
string
static FlaggedRevs::highestReviewTier ( )
static

Get the highest review tier that is enabled

Returns
int One of FR_PRISTINE,FR_QUALITY,FR_CHECKED
static FlaggedRevs::HTMLCacheUpdates ( Title  $title)
static

Do cache updates for when the stable version of a page changed. Invalidates/purges pages that include the given page.

Parameters
Title$title
static FlaggedRevs::inclusionSetting ( )
static

Return the include handling configuration

Returns
int
static FlaggedRevs::inReviewNamespace ( Title  $title)
static

Is this page in reviewable namespace? Note: this checks $wgFlaggedRevsWhitelist

Parameters
Title,$title
Returns
bool
static FlaggedRevs::isChecked ( array  $flags)
static
Parameters
array$flags
Returns
bool is this revision at basic review condition?
static FlaggedRevs::isPristine ( array  $flags)
static
Parameters
array$flags
Returns
bool is this revision at pristine review condition?
static FlaggedRevs::isQuality ( array  $flags)
static
Parameters
array$flags
Returns
bool is this revision at quality review condition?
static FlaggedRevs::isStableShownByDefault ( )
static

Is a "stable version" used as the default display version for all pages in reviewable namespaces?

Returns
bool
static FlaggedRevs::lowProfileUI ( )
static

Should tags only be shown for unreviewed content for this user?

Returns
bool
static FlaggedRevs::makeMemcObj (   $val)
static

Get a memcache storage object

Parameters
string$val
Returns
Object (val,time) tuple
static FlaggedRevs::markRevisionPatrolled ( Revision  $rev)
static

Mark a revision as patrolled if needed

Parameters
Revision$rev
Returns
bool DB write query used
static FlaggedRevs::maxAutoReviewLevel (   $tag)
static

Get the maximum level that $tag can be autoreviewed to

Parameters
string$tag
Returns
int
static FlaggedRevs::parseStableRevision ( FlaggedRevision  $frev,
ParserOptions  $pOpts 
)
static

Get the HTML output of a revision.

Parameters
FlaggedRevision$frev
ParserOptions$pOpts
Returns
ParserOutput|null
static FlaggedRevs::parseStableRevisionPooled ( FlaggedRevision  $frev,
ParserOptions  $pOpts 
)
static

Get the HTML output of a revision, using PoolCounter in the process

Returns a Status if pool is full, null if the revision is missing

Parameters
FlaggedRevision$frev
ParserOptions$pOpts
Returns
ParserOutput|Status|null
static FlaggedRevs::pristineVersions ( )
static

Are pristine versions enabled?

Returns
bool
static FlaggedRevs::purgeSquid ( Title  $title)
static
Parameters
Title$titleUpdates squid cache for a title. Defers till after main commit().
static FlaggedRevs::qualityVersions ( )
static

Are quality versions enabled?

Returns
bool
static FlaggedRevs::quickTags (   $tier)
static

Get minimum level tags for a tier

Parameters
int$tierFR_PRISTINE/FR_QUALITY/FR_CHECKED
Returns
array
static FlaggedRevs::stableVersionUpdates (   $page,
  $sv = null,
  $oldSv = null,
  $editInfo = null 
)
static

Update the page tables with a new stable version.

Parameters
WikiPage | Title$page
FlaggedRevision | null$svthe new stable version (optional)
FlaggedRevision | null$oldSvthe old stable version (optional)
Object$editInfoArticle edit info about the current revision (optional)
Returns
bool stable version text/file changed and FR_INCLUDES_STABLE
Exceptions
Exception
static FlaggedRevs::updateStableOnlyDeps ( Page  $article,
ParserOutput  $stableOut,
  $mode 
)
static
Parameters
Page$article
ParserOutput$stableOut
int$modeFRDependencyUpdate::DEFERRED/FRDependencyUpdate::IMMEDIATE Updates the stable-only cache dependency table
static FlaggedRevs::useOnlyIfProtected ( )
static

Are pages reviewable only if they have been manually configured by an admin to use a "stable version" as the default?

Returns
bool
static FlaggedRevs::useProtectionLevels ( )
static

Are there site defined protection levels for review

Returns
bool
static FlaggedRevs::userCanSetAutoreviewLevel (   $user,
  $right 
)
static

Check if a user can set the autoreview restiction level to $right

Parameters
User$user
string$rightthe level
Returns
bool
static FlaggedRevs::userCanSetFlags (   $user,
array  $flags,
  $oldflags = [] 
)
static

Returns true if a user can set $flags for a revision via review. Requires the same for $oldflags if given.

Parameters
User$user
array$flagssuggested flags
array$oldflagspre-existing flags
Returns
bool
static FlaggedRevs::userCanSetTag (   $user,
  $tag,
  $value 
)
static

Returns true if a user can set $tag to $value

Parameters
User$user
string$tag
int$value
Returns
bool
static FlaggedRevs::useSimpleConfig ( )
static

Whether simple configuration settings should be used

Returns
bool

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