From: TyA Date: Wed, 30 May 2012 03:49:17 +0000 (+0100) Subject: *(bug 30976) Add maintenance script to remove preferences from $wgHiddenPrefs X-Git-Tag: 1.31.0-rc.0~23140^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=67aa00f957265323ca0d50a709f442735cdc5fb2;p=lhc%2Fweb%2Fwiklou.git *(bug 30976) Add maintenance script to remove preferences from $wgHiddenPrefs Change-Id: Ie74fab1edeac2c6b275c51e6af3a7924b3aac46b --- diff --git a/maintenance/cleanupPreferences.php b/maintenance/cleanupPreferences.php new file mode 100755 index 0000000000..57a536962a --- /dev/null +++ b/maintenance/cleanupPreferences.php @@ -0,0 +1,29 @@ + + * @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 );