MediaWiki REL1_34
updateDatabaseValueFormat.php
Go to the documentation of this file.
1<?php
29
30if ( getenv( 'MW_INSTALL_PATH' ) ) {
31 $IP = getenv( 'MW_INSTALL_PATH' );
32} else {
33 $IP = __DIR__ . '/../../..';
34}
35require_once "$IP/maintenance/Maintenance.php";
36
38 public function __construct() {
39 parent::__construct();
40 $this->addDescription( 'Script to convert old, TOTP specific, column values to new structure' );
41 $this->requireExtension( 'OATHAuth' );
42 }
43
47 public function execute() {
48 global $wgOATHAuthDatabase;
49 $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()
50 ->getMainLB( $wgOATHAuthDatabase );
51 $dbw = $lb->getConnectionRef( DB_MASTER, [], $wgOATHAuthDatabase );
52
53 if ( !UpdateTables::convertToGenericFields( $dbw ) ) {
54 $this->error( "Failed to update the data structure rows.\n", 1 );
55 }
56 $this->output( "Done.\n" );
57 }
58}
59
60$maintClass = UpdateDatabaseValueFormat::class;
61require_once RUN_MAINTENANCE_IF_MAIN;
const RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
error( $err, $die=0)
Throw an error to the user.
requireExtension( $name)
Indicate that the specified extension must be loaded before the script can run.
output( $out, $channel=null)
Throw some output to the user.
addDescription( $text)
Set the description text.
MediaWikiServices is the service locator for the application scope of MediaWiki.
$IP
Definition update.php:3
const DB_MASTER
Definition defines.php:26