MediaWiki master
CleanupInvalidDbKeys Class Reference

Maintenance script that cleans up invalid titles in various tables. More...

Inherits Maintenance.

Collaboration diagram for CleanupInvalidDbKeys:

Public Member Functions

 __construct ()
 
 execute ()
 

Protected Member Functions

 cleanupTable ( $tableParams)
 Identifies, and optionally cleans up, invalid titles.
 
 outputStatus ( $str, $channel=null)
 Prints text to STDOUT, and STDERR if STDOUT was redirected to a file.
 
 writeToReport ( $str)
 Prints text to STDOUT.
 

Static Protected Member Functions

static makeValidTitle ( $invalidTitle)
 Fix possible validation issues in the given title (DB key).
 

Static Protected Attributes

static array[] $tables
 List of tables to clean up, and the field prefix for that table.
 

Detailed Description

Maintenance script that cleans up invalid titles in various tables.

Since
1.29

Definition at line 39 of file cleanupInvalidDbKeys.php.

Constructor & Destructor Documentation

◆ __construct()

CleanupInvalidDbKeys::__construct ( )

Definition at line 61 of file cleanupInvalidDbKeys.php.

Member Function Documentation

◆ cleanupTable()

CleanupInvalidDbKeys::cleanupTable ( $tableParams)
protected

Identifies, and optionally cleans up, invalid titles.

Parameters
array$tableParamsA child array of self::$tables

Definition at line 132 of file cleanupInvalidDbKeys.php.

References $tables, DB_REPLICA, makeValidTitle(), outputStatus(), run(), and writeToReport().

Referenced by execute().

◆ execute()

CleanupInvalidDbKeys::execute ( )

Definition at line 88 of file cleanupInvalidDbKeys.php.

References cleanupTable(), and outputStatus().

◆ makeValidTitle()

static CleanupInvalidDbKeys::makeValidTitle ( $invalidTitle)
staticprotected

Fix possible validation issues in the given title (DB key).

Parameters
string$invalidTitle
Returns
string

Definition at line 334 of file cleanupInvalidDbKeys.php.

Referenced by cleanupTable().

◆ outputStatus()

CleanupInvalidDbKeys::outputStatus ( $str,
$channel = null )
protected

Prints text to STDOUT, and STDERR if STDOUT was redirected to a file.

Used for progress reporting.

Parameters
string$strText to write to both places
string | null$channelIgnored

Definition at line 110 of file cleanupInvalidDbKeys.php.

Referenced by cleanupTable(), and execute().

◆ writeToReport()

CleanupInvalidDbKeys::writeToReport ( $str)
protected

Prints text to STDOUT.

Used for logging output.

Parameters
string$strText to write

Definition at line 123 of file cleanupInvalidDbKeys.php.

Referenced by cleanupTable().

Member Data Documentation

◆ $tables

array [] CleanupInvalidDbKeys::$tables
staticprotected
Initial value:
= [
[ 'page', 'page' ],
[ 'redirect', 'rd', 'idField' => 'rd_from' ],
[ 'archive', 'ar' ],
[ 'logging', 'log' ],
[ 'protected_titles', 'pt', 'idField' => 0 ],
[ 'category', 'cat', 'nsField' => 14 ],
[ 'recentchanges', 'rc' ],
[ 'watchlist', 'wl' ],
[ 'pagelinks', 'pl', 'idField' => 'pl_from' ],
[ 'templatelinks', 'tl', 'idField' => 'tl_from' ],
[ 'categorylinks', 'cl', 'idField' => 'cl_from', 'nsField' => 14, 'titleField' => 'cl_to' ],
[ 'imagelinks', 'il', 'idField' => 'il_from', 'nsField' => 6, 'titleField' => 'il_to' ],
]

List of tables to clean up, and the field prefix for that table.

Definition at line 41 of file cleanupInvalidDbKeys.php.

Referenced by cleanupTable().


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