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