24 require_once __DIR__ .
'/Maintenance.php';
36 parent::__construct();
37 $this->
addDescription(
'Convert user options from old to new system' );
42 $this->
output(
"...batch conversion of user_options: " );
46 if ( !$dbw->fieldExists(
'user',
'user_options', __METHOD__ ) ) {
47 $this->
output(
"nothing to migrate. " );
51 while ( $id !== null ) {
52 $res = $dbw->select(
'user',
53 [
'user_id',
'user_options' ],
55 'user_id > ' . $dbw->addQuotes( $id ),
56 "user_options != " . $dbw->addQuotes(
'' ),
60 'ORDER BY' =>
'user_id',
69 $this->
output(
"--Converted to ID $id\n" );
72 $this->
output(
"done. Converted " . $this->mConversionCount .
" user records.\n" );
83 $this->mConversionCount++;
85 foreach ( explode(
"\n", $row->user_options )
as $s ) {
87 if ( !preg_match(
"/^(.[^=]*)=(.*)$/", $s, $m ) ) {
94 if ( is_null( $defaultOption ) || $m[2] != $defaultOption ) {
96 'up_user' => $row->user_id,
97 'up_property' => $m[1],
103 if ( count( $insertRows ) ) {
104 $dbw->insert(
'user_properties', $insertRows, __METHOD__, [
'IGNORE' ] );
109 [
'user_options' =>
'' ],
110 [
'user_id' => $row->user_id ],
wfWaitForSlaves($ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null)
Waits for the replica DBs to catch up to the master position.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Maintenance script to convert user options to the new user_properties table.
getDB($db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
require_once RUN_MAINTENANCE_IF_MAIN
addDescription($text)
Set the description text.
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
output($out, $channel=null)
Throw some output to the user.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
int $mBatchSize
Batch size.
setBatchSize($s=0)
Set the batch size.
static getDefaultOption($opt)
Get a given default option value.
convertOptionBatch($res, $dbw)