*(bug 30976) Add maintenance script to remove preferences from $wgHiddenPrefs

Change-Id: Ie74fab1edeac2c6b275c51e6af3a7924b3aac46b
This commit is contained in:
TyA 2012-05-30 04:49:17 +01:00 committed by Reedy
parent eacc9b8d9f
commit 67aa00f957

View file

@ -0,0 +1,29 @@
<?php
/**
* Description: This script takes $wgHiddenPrefs and removes their preference from the DB. [[bugzilla:30976]]
* @author TyA <tya.wiki@gmail.com>
* @ingroup Maintenance
*/
require_once( dirname( __FILE__ ) . '/Maintenance.php' );
class CleanupPreferences extends Maintenance {
public function execute() {
global $wgHiddenPrefs;
$dbw = wfGetDB( DB_MASTER );
$dbw->begin();
foreach( $wgHiddenPrefs as $item ) {
$dbw->delete(
'user_properties',
array( 'up_property' => $item ),
__METHOD__
);
};
$dbw->commit();
$this->output( "Finished!\n" );
}
}
$maintClass = 'CleanupPreferences'; // Tells it to run the class
require_once( RUN_MAINTENANCE_IF_MAIN );