MediaWiki  REL1_31
CheckLanguageCLI Class Reference
Inheritance diagram for CheckLanguageCLI:

Public Member Functions

 __construct (array $options)
 
 execute ()
 Execute the script. More...
 
 outputWiki ()
 Output the checks results as wiki text. More...
 

Protected Member Functions

 checkLanguage ( $code)
 Check a language. More...
 
 defaultChecks ()
 Get the default checks. More...
 
 doChecks ()
 Execute the checks. More...
 
 easyChecks ()
 Get the checks that can easily be treated by non-speakers of the language. More...
 
 formatKey ( $key, $code)
 Format a message key. More...
 
 getCheckBlacklist ()
 Get the check blacklist. More...
 
 getChecks ()
 Get all checks. More...
 
 getDescriptions ()
 Get all check descriptions. More...
 
 getTotalCount ()
 Get total count for each check non-messages check. More...
 
 help ()
 Get help. More...
 
 isCheckBlacklisted ( $check, $code, $message)
 Verify whether a check is blacklisted. More...
 
 isEmpty ()
 Check if there are any results for the checks, in any language. More...
 
 nonMessageChecks ()
 Get the checks which check other things than messages. More...
 
 outputText ()
 Output the checks results as plain text. More...
 

Protected Attributes

 $checkAll = false
 
 $checks = []
 
 $code = null
 
 $doLinks = false
 
 $L = null
 
 $level = 2
 
 $linksPrefix = ''
 
 $output = 'plain'
 
 $results = []
 
 $wikiCode = 'en'
 

Private Attributes

 $includeExif = false
 

Detailed Description

Definition at line 27 of file checkLanguage.inc.

Constructor & Destructor Documentation

◆ __construct()

CheckLanguageCLI::__construct ( array  $options)
Parameters
array$optionsOptions for script.

Definition at line 45 of file checkLanguage.inc.

References $options, $wgLanguageCode, code, defaultChecks(), easyChecks(), global, help(), and output().

Member Function Documentation

◆ checkLanguage()

CheckLanguageCLI::checkLanguage (   $code)
protected

Check a language.

Parameters
string$codeThe language code.
Exceptions
MWException
Returns
array The results.

Reimplemented in CheckExtensionsCLI.

Definition at line 383 of file checkLanguage.inc.

References $code, $L, $results, as, getChecks(), and isCheckBlacklisted().

Referenced by doChecks(), and help().

◆ defaultChecks()

CheckLanguageCLI::defaultChecks ( )
protected

Get the default checks.

Returns
array A list of the default checks.

Reimplemented in CheckExtensionsCLI.

Definition at line 98 of file checkLanguage.inc.

Referenced by __construct().

◆ doChecks()

CheckLanguageCLI::doChecks ( )
protected

Execute the checks.

Definition at line 293 of file checkLanguage.inc.

References $checks, $code, $messages, $results, as, checkLanguage(), code, and isCheckBlacklisted().

Referenced by execute(), and CheckExtensionsCLI\execute().

◆ easyChecks()

CheckLanguageCLI::easyChecks ( )
protected

Get the checks that can easily be treated by non-speakers of the language.

Returns
array A list of the easy checks.

Reimplemented in CheckExtensionsCLI.

Definition at line 122 of file checkLanguage.inc.

Referenced by __construct().

◆ execute()

CheckLanguageCLI::execute ( )

Execute the script.

Reimplemented in CheckExtensionsCLI.

Definition at line 274 of file checkLanguage.inc.

References doChecks(), output(), outputText(), and outputWiki().

◆ formatKey()

CheckLanguageCLI::formatKey (   $key,
  $code 
)
protected

Format a message key.

Parameters
string$keyThe message key.
string$codeThe language code.
Returns
string The formatted message key.

Definition at line 415 of file checkLanguage.inc.

References $code.

Referenced by outputText(), and outputWiki().

◆ getCheckBlacklist()

CheckLanguageCLI::getCheckBlacklist ( )
protected

Get the check blacklist.

Returns
array The list of checks which should not be executed.

Definition at line 328 of file checkLanguage.inc.

References $checkBlacklist, global, and Hooks\run().

Referenced by isCheckBlacklisted().

◆ getChecks()

CheckLanguageCLI::getChecks ( )
protected

Get all checks.

Returns
array An array of all check names mapped to their function names.

Definition at line 133 of file checkLanguage.inc.

Referenced by checkLanguage().

◆ getDescriptions()

CheckLanguageCLI::getDescriptions ( )
protected

Get all check descriptions.

Returns
array An array of all check names mapped to their descriptions.

Definition at line 180 of file checkLanguage.inc.

Referenced by outputText().

◆ getTotalCount()

CheckLanguageCLI::getTotalCount ( )
protected

Get total count for each check non-messages check.

Returns
array An array of all check names mapped to a two-element array: function name to get the total count and language code or null for checked code.

Definition at line 163 of file checkLanguage.inc.

Referenced by outputText().

◆ help()

CheckLanguageCLI::help ( )
protected

Get help.

Returns
string The help string.

Reimplemented in CheckExtensionsCLI.

Definition at line 212 of file checkLanguage.inc.

References add, and(), are, broken, by, check, checkLanguage(), code, complete, content, display, errors, file, following, form, headers, in, is(), line, links, list, message, messages, names, of, on, or, other(), output(), page, pages, project, settings, Special, that, them, Makefile\translate(), used, values, well, were, and wiki.

Referenced by __construct().

◆ isCheckBlacklisted()

CheckLanguageCLI::isCheckBlacklisted (   $check,
  $code,
  $message 
)
protected

Verify whether a check is blacklisted.

Parameters
string$checkCheck name
string$codeLanguage code
string | bool$messageMessage name, or False for a whole language
Returns
bool Whether the check is blacklisted

Definition at line 353 of file checkLanguage.inc.

References $code, as, and getCheckBlacklist().

Referenced by checkLanguage(), and doChecks().

◆ isEmpty()

CheckLanguageCLI::isEmpty ( )
protected

Check if there are any results for the checks, in any language.

Returns
bool True if there are any results, false if not.

Definition at line 538 of file checkLanguage.inc.

References $messages, $results, and as.

Referenced by CheckExtensionsCLI\checkLanguage().

◆ nonMessageChecks()

CheckLanguageCLI::nonMessageChecks ( )
protected

Get the checks which check other things than messages.

Returns
array A list of the non-message checks.

Reimplemented in CheckExtensionsCLI.

Definition at line 111 of file checkLanguage.inc.

Referenced by outputText(), and outputWiki().

◆ outputText()

CheckLanguageCLI::outputText ( )
protected

Output the checks results as plain text.

Definition at line 431 of file checkLanguage.inc.

References $code, $L, $messages, $results, $value, as, formatKey(), getDescriptions(), getTotalCount(), and nonMessageChecks().

Referenced by CheckExtensionsCLI\checkLanguage(), and execute().

◆ outputWiki()

CheckLanguageCLI::outputWiki ( )

Output the checks results as wiki text.

Definition at line 476 of file checkLanguage.inc.

References $code, $messages, $results, $rows, are, as, code, Language\fetchLanguageName(), formatKey(), SpecialVersion\getVersion(), nonMessageChecks(), and style.

Referenced by CheckExtensionsCLI\checkLanguage(), and execute().

Member Data Documentation

◆ $checkAll

CheckLanguageCLI::$checkAll = false
protected

Definition at line 33 of file checkLanguage.inc.

◆ $checks

CheckLanguageCLI::$checks = []
protected

Definition at line 35 of file checkLanguage.inc.

Referenced by doChecks().

◆ $code

CheckLanguageCLI::$code = null
protected

◆ $doLinks

CheckLanguageCLI::$doLinks = false
protected

Definition at line 30 of file checkLanguage.inc.

◆ $includeExif

CheckLanguageCLI::$includeExif = false
private

Definition at line 40 of file checkLanguage.inc.

◆ $L

CheckLanguageCLI::$L = null
protected

Definition at line 36 of file checkLanguage.inc.

Referenced by checkLanguage(), and outputText().

◆ $level

CheckLanguageCLI::$level = 2
protected

Definition at line 29 of file checkLanguage.inc.

◆ $linksPrefix

CheckLanguageCLI::$linksPrefix = ''
protected

Definition at line 31 of file checkLanguage.inc.

◆ $output

CheckLanguageCLI::$output = 'plain'
protected

Definition at line 34 of file checkLanguage.inc.

◆ $results

CheckLanguageCLI::$results = []
protected

Definition at line 38 of file checkLanguage.inc.

Referenced by checkLanguage(), doChecks(), isEmpty(), outputText(), and outputWiki().

◆ $wikiCode

CheckLanguageCLI::$wikiCode = 'en'
protected

Definition at line 32 of file checkLanguage.inc.


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