Use HookHandlers for core hooks
Bug: T271018 Change-Id: I0d39f6dfd693608e67883a2b6eeaeb8a855b1695
这个提交包含在:
父节点
2e8a5b0283
当前提交
aa773792a0
|
@ -9,7 +9,7 @@
|
||||||
"Roan Kattouw"
|
"Roan Kattouw"
|
||||||
],
|
],
|
||||||
"requires": {
|
"requires": {
|
||||||
"MediaWiki": ">= 1.34.0"
|
"MediaWiki": ">= 1.35.0"
|
||||||
},
|
},
|
||||||
"url": "https://www.mediawiki.org/wiki/Extension:LocalisationUpdate",
|
"url": "https://www.mediawiki.org/wiki/Extension:LocalisationUpdate",
|
||||||
"descriptionmsg": "localisationupdate-desc",
|
"descriptionmsg": "localisationupdate-desc",
|
||||||
|
@ -24,8 +24,13 @@
|
||||||
"LocalisationUpdate\\": "includes/"
|
"LocalisationUpdate\\": "includes/"
|
||||||
},
|
},
|
||||||
"Hooks": {
|
"Hooks": {
|
||||||
"LocalisationCacheRecache": "LocalisationUpdate\\LocalisationUpdate::onRecache",
|
"LocalisationCacheRecache": "main",
|
||||||
"LocalisationCacheRecacheFallback": "LocalisationUpdate\\LocalisationUpdate::onRecacheFallback"
|
"LocalisationCacheRecacheFallback": "main"
|
||||||
|
},
|
||||||
|
"HookHandlers": {
|
||||||
|
"main": {
|
||||||
|
"class": "LocalisationUpdate\\LocalisationUpdate"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"LocalisationUpdateDirectory": {
|
"LocalisationUpdateDirectory": {
|
||||||
|
|
|
@ -5,18 +5,23 @@ namespace LocalisationUpdate;
|
||||||
use FileDependency;
|
use FileDependency;
|
||||||
use FormatJson;
|
use FormatJson;
|
||||||
use LocalisationCache;
|
use LocalisationCache;
|
||||||
|
use MediaWiki\Hook\LocalisationCacheRecacheFallbackHook;
|
||||||
|
use MediaWiki\Hook\LocalisationCacheRecacheHook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for localization update hooks and static methods.
|
* Class for localization update hooks and static methods.
|
||||||
*/
|
*/
|
||||||
class LocalisationUpdate {
|
class LocalisationUpdate implements
|
||||||
|
LocalisationCacheRecacheHook,
|
||||||
|
LocalisationCacheRecacheFallbackHook
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Hook: LocalisationCacheRecacheFallback
|
* Hook: LocalisationCacheRecacheFallback
|
||||||
* @param LocalisationCache $lc
|
* @param LocalisationCache $lc
|
||||||
* @param string $code
|
* @param string $code
|
||||||
* @param array &$cache
|
* @param array &$cache
|
||||||
*/
|
*/
|
||||||
public static function onRecacheFallback( LocalisationCache $lc, $code, array &$cache ) {
|
public function onLocalisationCacheRecacheFallback( $lc, $code, &$cache ) {
|
||||||
$dir = self::getDirectory();
|
$dir = self::getDirectory();
|
||||||
if ( !$dir ) {
|
if ( !$dir ) {
|
||||||
return;
|
return;
|
||||||
|
@ -34,8 +39,9 @@ class LocalisationUpdate {
|
||||||
* @param LocalisationCache $lc
|
* @param LocalisationCache $lc
|
||||||
* @param string $code
|
* @param string $code
|
||||||
* @param array &$cache
|
* @param array &$cache
|
||||||
|
* @param ?mixed $unused
|
||||||
*/
|
*/
|
||||||
public static function onRecache( LocalisationCache $lc, $code, array &$cache ) {
|
public function onLocalisationCacheRecache( $lc, $code, &$cache, $unused ) {
|
||||||
$dir = self::getDirectory();
|
$dir = self::getDirectory();
|
||||||
if ( !$dir ) {
|
if ( !$dir ) {
|
||||||
return;
|
return;
|
||||||
|
|
正在加载...
在新工单中引用