Go to the documentation of this file.
25 require_once __DIR__ .
'/Maintenance.php';
35 parent::__construct();
36 $this->mDescription =
"Populates the rev_len and ar_len fields";
41 return 'populate rev_len and ar_len';
46 if ( !$db->tableExists(
'revision' ) ) {
47 $this->
error(
"revision table does not exist",
true );
48 } elseif ( !$db->tableExists(
'archive' ) ) {
49 $this->
error(
"archive table does not exist",
true );
50 } elseif ( !$db->fieldExists(
'revision',
'rev_len', __METHOD__ ) ) {
51 $this->
output(
"rev_len column does not exist\n\n",
true );
55 $this->
output(
"Populating rev_len column\n" );
58 $this->
output(
"Populating ar_len column\n" );
61 $this->
output(
"rev_len and ar_len population complete [$rev revision rows, $ar archive rows].\n" );
72 protected function doLenUpdates( $table, $idCol, $prefix, $fields ) {
74 $start = $db->selectField( $table,
"MIN($idCol)",
false, __METHOD__ );
75 $end = $db->selectField( $table,
"MAX($idCol)",
false, __METHOD__ );
76 if ( !$start || !$end ) {
77 $this->
output(
"...$table table seems to be empty.\n" );
82 $blockStart = intval( $start );
83 $blockEnd = intval( $start ) + $this->mBatchSize - 1;
86 while ( $blockStart <= $end ) {
87 $this->
output(
"...doing $idCol from $blockStart to $blockEnd\n" );
92 "$idCol >= $blockStart",
93 "$idCol <= $blockEnd",
94 "{$prefix}_len IS NULL"
99 $db->begin( __METHOD__ );
100 # Go through and update rev_len from these rows.
101 foreach (
$res as $row ) {
102 if ( $this->
upgradeRow( $row, $table, $idCol, $prefix ) ) {
106 $db->commit( __METHOD__ );
123 protected function upgradeRow( $row, $table, $idCol, $prefix ) {
126 $rev = ( $table ===
'archive' )
130 $content =
$rev->getContent();
132 # This should not happen, but sometimes does (bug 20757)
134 $this->
output(
"Content of $table $id unavailable!\n" );
140 array(
"{$prefix}_len" => $content->getSize() ),
141 array( $idCol => $row->$idCol ),
int $mBatchSize
Batch size.
Maintenance script that populates the rev_len and ar_len fields for old revisions created before MW 1...
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
doDBUpdates()
Do the actual work.
upgradeRow( $row, $table, $idCol, $prefix)
require_once RUN_MAINTENANCE_IF_MAIN
& getDB( $db, $groups=array(), $wiki=false)
Returns a database to be used by current maintenance script.
Class for scripts that perform database maintenance and want to log the update in updatelog so we can...
getUpdateKey()
Get the update key name to go in the update log table.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
wfWaitForSlaves( $maxLag=false, $wiki=false, $cluster=false)
Modern version of wfWaitForSlaves().
doLenUpdates( $table, $idCol, $prefix, $fields)
static selectArchiveFields()
Return the list of revision fields that should be selected to create a new revision from an archive r...
static newFromArchiveRow( $row, $overrides=array())
Make a fake revision object from an archive table row.
__construct()
Default constructor.
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
setBatchSize( $s=0)
Set the batch size.