mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-27 16:50:00 +00:00
Prevent gadget preferences from being cleaned up
Bug: T188966 Change-Id: I5627f014827fdbf266eb7fdb00a446f81a0c3458
This commit is contained in:
parent
441302fb5e
commit
97c5bd7732
|
@ -108,6 +108,9 @@
|
|||
],
|
||||
"wgQueryPages": [
|
||||
"GadgetHooks::onwgQueryPages"
|
||||
],
|
||||
"DeleteUnknownPreferences": [
|
||||
"GadgetHooks::onDeleteUnknownPreferences"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*
|
||||
* @file
|
||||
*/
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
use Wikimedia\WrappedString;
|
||||
|
||||
class GadgetHooks {
|
||||
|
@ -327,4 +328,15 @@ class GadgetHooks {
|
|||
$queryPages[] = [ 'SpecialGadgetUsage', 'GadgetUsage' ];
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent gadget preferences from being deleted.
|
||||
* @link https://www.mediawiki.org/wiki/Manual:Hooks/DeleteUnknownPreferences
|
||||
* @suppress PhanParamTooMany
|
||||
* @param string[] &$where Array of where clause conditions to add to.
|
||||
* @param IDatabase $db
|
||||
*/
|
||||
public static function onDeleteUnknownPreferences( &$where, IDatabase $db ) {
|
||||
$where[] = 'up_property NOT' . $db->buildLike( 'gadget-', $db->anyString() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue