24require_once __DIR__ .
'/Maintenance.php';
34 parent::__construct();
36 'Migrates content from pre-1.5 ar_text and ar_flags columns to text storage'
40 "For rows with missing or unloadable data, throw away whatever is there and\n"
41 .
"mark them as \"error\" in the database."
50 $this->mOptions[
'force'] =
$forced;
60 $replaceMissing = $this->
hasOption(
'replace-missing' );
65 if ( !
$dbr->fieldExists(
'archive',
'ar_text', __METHOD__ ) ||
66 !$dbw->fieldExists(
'archive',
'ar_text', __METHOD__ )
68 $this->
output(
"No ar_text field, so nothing to migrate.\n" );
72 $this->
output(
"Migrating ar_text to modern storage...\n" );
79 [
'ar_id',
'ar_text',
'ar_flags' ],
85 [
'LIMIT' => $batchSize,
'ORDER BY' => [
'ar_id' ] ]
87 $numRows =
$res->numRows();
89 foreach (
$res as $row ) {
94 if ( !
in_array(
'external', explode(
',', $row->ar_flags ),
true ) ) {
96 if (
$data !==
false ) {
100 $data = ExternalStore::insertToDefault(
$data );
102 throw new MWException(
"Unable to store text to external storage" );
107 $flags .=
'external';
109 }
elseif ( $replaceMissing ) {
110 $this->
error(
"Replacing missing data for row ar_id=$row->ar_id" );
111 $data =
'Missing data in migrateArchiveText.php on ' . date(
'c' );
114 $this->
error(
"No data for row ar_id=$row->ar_id" );
119 $flags = $row->ar_flags;
120 $data = $row->ar_text;
126 [
'old_text' =>
$data,
'old_flags' => $flags ],
129 $id = $dbw->insertId();
132 [
'ar_text_id' => $id,
'ar_text' =>
'',
'ar_flags' =>
'' ],
133 [
'ar_id' => $row->ar_id,
'ar_text_id' =>
null ],
136 $count += $dbw->affectedRows();
140 if ( $numRows < $batchSize ) {
145 $this->
output(
"... $last\n" );
149 $this->
output(
"Completed ar_text migration, $count rows updated, $errors missing data.\n" );
151 $this->
output(
"Run with --replace-missing to overwrite missing data with an error message.\n" );
154 return $errors === 0;
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
array $wgDefaultExternalStore
The place to put new revisions, false to put them in the local text table.
Class for scripts that perform database maintenance and want to log the update in updatelog so we can...
beginTransaction(IDatabase $dbw, $fname)
Begin a transcation on a DB.
commitTransaction(IDatabase $dbw, $fname)
Commit the transcation on a DB handle and wait for replica DBs to catch up.
output( $out, $channel=null)
Throw some output to the user.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
hasOption( $name)
Checks to see if a particular option exists.
getBatchSize()
Returns batch size.
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
Maintenance script that migrates archive.ar_text and ar_flags to text storage.
setForce( $forced=true)
Sets whether a run of this maintenance script has the force parameter set.
doDBUpdates()
Do the actual work.
__construct()
Default constructor.
getUpdateKey()
Get the update key name to go in the update log table.
static compressRevisionText(&$text)
If $wgCompressRevisions is enabled, we will compress data.
static getRevisionText( $row, $prefix='old_', $wiki=false)
Get revision text associated with an old or archive row.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
require_once RUN_MAINTENANCE_IF_MAIN