mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-23 23:13:27 +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": [
|
"wgQueryPages": [
|
||||||
"GadgetHooks::onwgQueryPages"
|
"GadgetHooks::onwgQueryPages"
|
||||||
|
],
|
||||||
|
"DeleteUnknownPreferences": [
|
||||||
|
"GadgetHooks::onDeleteUnknownPreferences"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*
|
*
|
||||||
* @file
|
* @file
|
||||||
*/
|
*/
|
||||||
|
use Wikimedia\Rdbms\IDatabase;
|
||||||
use Wikimedia\WrappedString;
|
use Wikimedia\WrappedString;
|
||||||
|
|
||||||
class GadgetHooks {
|
class GadgetHooks {
|
||||||
|
@ -327,4 +328,15 @@ class GadgetHooks {
|
||||||
$queryPages[] = [ 'SpecialGadgetUsage', 'GadgetUsage' ];
|
$queryPages[] = [ 'SpecialGadgetUsage', 'GadgetUsage' ];
|
||||||
return true;
|
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