*(bug 30976) Add maintenance script to remove preferences from $wgHiddenPrefs
Change-Id: Ie74fab1edeac2c6b275c51e6af3a7924b3aac46b
This commit is contained in:
parent
eacc9b8d9f
commit
67aa00f957
1 changed files with 29 additions and 0 deletions
29
maintenance/cleanupPreferences.php
Executable file
29
maintenance/cleanupPreferences.php
Executable 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 );
|
||||||
Loading…
Reference in a new issue