summaryrefslogtreecommitdiff
path: root/extensions/Vector/switchExperimentPrefs.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /extensions/Vector/switchExperimentPrefs.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'extensions/Vector/switchExperimentPrefs.php')
-rw-r--r--extensions/Vector/switchExperimentPrefs.php63
1 files changed, 0 insertions, 63 deletions
diff --git a/extensions/Vector/switchExperimentPrefs.php b/extensions/Vector/switchExperimentPrefs.php
deleted file mode 100644
index 82ddd868..00000000
--- a/extensions/Vector/switchExperimentPrefs.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-
-$path = '../..';
-
-if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
- $path = getenv( 'MW_INSTALL_PATH' );
-}
-
-require_once( $path . '/maintenance/Maintenance.php' );
-
-class SwitchExperimentPrefs extends Maintenance {
- function __construct() {
- parent::__construct();
- $this->addOption( 'pref', 'Preference to set', true, true );
- $this->addOption( 'value', 'Value to set the preference to', true, true );
- $this->mDescription = 'Set a preference for all users that have the vector-noexperiments preference enabled.';
- }
-
- function execute() {
- $dbw = wfGetDB( DB_MASTER );
-
- $batchSize = 100;
- $total = 0;
- $lastUserID = 0;
- while ( true ) {
- $res = $dbw->select( 'user_properties', array( 'up_user' ),
- array( 'up_property' => 'vector-noexperiments', "up_user > $lastUserID" ),
- __METHOD__,
- array( 'LIMIT' => $batchSize ) );
- if ( !$res->numRows() ) {
- $dbw->commit();
- break;
- }
- $total += $res->numRows();
-
- $ids = array();
- foreach ( $res as $row ) {
- $ids[] = $row->up_user;
- }
- $lastUserID = max( $ids );
-
-
- foreach ( $ids as $id ) {
- $user = User::newFromId( $id );
- if ( !$user->isLoggedIn() )
- continue;
- $user->setOption( $this->getOption( 'pref' ), $this->getOption( 'value' ) );
- $user->saveSettings();
- }
-
- echo "$total\n";
-
- wfWaitForSlaves(); // Must be wfWaitForSlaves_masterPos(); on 1.17wmf1
- }
- echo "Done\n";
-
- }
-}
-
-$maintClass = 'SwitchExperimentPrefs';
-require_once( RUN_MAINTENANCE_IF_MAIN );
-
-