MediaWiki  master
renameRestrictions.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/Maintenance.php';
25 
33  public function __construct() {
34  parent::__construct();
35  $this->addDescription( 'Rename a restriction level' );
36  $this->addArg( 'oldlevel', 'Old name of restriction level', true );
37  $this->addArg( 'newlevel', 'New name of restriction level', true );
38  }
39 
40  public function execute() {
41  $oldLevel = $this->getArg( 0 );
42  $newLevel = $this->getArg( 1 );
43 
44  $dbm = wfGetDB( DB_MASTER );
45  $dbm->update(
46  'page_restrictions',
47  [ 'pr_level' => $newLevel ],
48  [ 'pr_level' => $oldLevel ]
49  );
50  }
51 
52 }
53 
54 $maintClass = RenameRestrictions::class;
55 require_once RUN_MAINTENANCE_IF_MAIN;
getArg( $argId=0, $default=null)
Get an argument.
const RUN_MAINTENANCE_IF_MAIN
Definition: Maintenance.php:39
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: Maintenance.php:86
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
const DB_MASTER
Definition: defines.php:26
addDescription( $text)
Set the description text.
addArg( $arg, $description, $required=true)
Add some args that are needed.
Maintenance script that updates page_restrictions table with a renamed restriction level...