X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcleanupPreferences.php;h=33cc0ca27d70465821b56fe98faab1e390ac0029;hb=1faaef19a9801f81f7fc185a3eb97faafb08b767;hp=a21bc73704f2034792f8ce0cb5c443717570937e;hpb=77e3624caba072521fbc1826af2d47f9b29f4032;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupPreferences.php b/maintenance/cleanupPreferences.php index a21bc73704..33cc0ca27d 100644 --- a/maintenance/cleanupPreferences.php +++ b/maintenance/cleanupPreferences.php @@ -87,15 +87,14 @@ class CleanupPreferences extends Maintenance { // Remove unknown preferences. Special-case gadget- and userjs- as we can't // control those names. if ( $unknown ) { - $this->deleteByWhere( - $dbw, - 'Dropping unknown preferences', - [ - 'up_property NOT' . $dbw->buildLike( 'gadget-', $dbw->anyString() ), - 'up_property NOT' . $dbw->buildLike( 'userjs-', $dbw->anyString() ), - 'up_property NOT IN (' . $dbw->makeList( array_keys( $wgDefaultUserOptions ) ) . ')', - ] - ); + $where = [ + 'up_property NOT' . $dbw->buildLike( 'gadget-', $dbw->anyString() ), + 'up_property NOT' . $dbw->buildLike( 'userjs-', $dbw->anyString() ), + 'up_property NOT IN (' . $dbw->makeList( array_keys( $wgDefaultUserOptions ) ) . ')', + ]; + // Allow extensions to add to the where clause to prevent deletion of their own prefs. + Hooks::run( 'DeleteUnknownPreferences', [ &$where, $dbw ] ); + $this->deleteByWhere( $dbw, 'Dropping unknown preferences', $where ); } // Something something phase 3