diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:31:04 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-06-04 07:58:39 +0200 |
commit | f6d65e533c62f6deb21342d4901ece24497b433e (patch) | |
tree | f28adf0362d14bcd448f7b65a7aaf38650f923aa /extensions/LocalisationUpdate/finder/Finder.php | |
parent | c27b2e832fe25651ef2410fae85b41072aae7519 (diff) |
Update to MediaWiki 1.25.1
Diffstat (limited to 'extensions/LocalisationUpdate/finder/Finder.php')
-rw-r--r-- | extensions/LocalisationUpdate/finder/Finder.php | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/extensions/LocalisationUpdate/finder/Finder.php b/extensions/LocalisationUpdate/finder/Finder.php index 5c598730..dc3a7f69 100644 --- a/extensions/LocalisationUpdate/finder/Finder.php +++ b/extensions/LocalisationUpdate/finder/Finder.php @@ -41,24 +41,34 @@ class LU_Finder { unset( $this->php[$key] ); foreach ( (array)$value as $subkey => $subvalue ) { - // This ignores magic, alias etc. non message files + // Mediawiki core files $matches = array(); - $ok = preg_match( '~/extensions/(?P<name>[^/]+)/(?P<path>.*)$~', $subvalue, $matches ); - if ( !$ok ) { + if ( preg_match( '~/(?P<path>(?:includes|languages|resources)/.*)$~', $subvalue, $matches ) ) { + $components["$key-$subkey"] = array( + 'repo' => 'mediawiki', + 'orig' => "file://$value/*.json", + 'path' => "{$matches['path']}/*.json", + ); continue; } - $components["$key-$subkey"] = array( - 'repo' => 'extension', - 'name' => $matches['name'], - 'orig' => "file://$subvalue/*.json", - 'path' => "{$matches['path']}/*.json", - ); + $item = $this->getItem( 'extensions', $subvalue ); + if ( $item !== null ) { + $item['repo'] = 'extension'; + $components["$key-$subkey"] = $item; + continue; + } + + $item = $this->getItem( 'skins', $subvalue ); + if ( $item !== null ) { + $item['repo'] = 'skin'; + $components["$key-$subkey"] = $item; + continue; + } } } foreach ( $this->php as $key => $value ) { - // This currently skips core i18n files like resources/oojs-ui/i18n $matches = array(); $ok = preg_match( '~/extensions/(?P<name>[^/]+)/(?P<path>.*\.i18n\.php)$~', $value, $matches ); if ( !$ok ) { @@ -75,4 +85,23 @@ class LU_Finder { return $components; } + + /** + * @param string $dir extensions or skins + * @param string $subvalue + * @return array|null + */ + private function getItem( $dir, $subvalue ) { + // This ignores magic, alias etc. non message files + $matches = array(); + if ( !preg_match( "~/$dir/(?P<name>[^/]+)/(?P<path>.*)$~", $subvalue, $matches ) ) { + return null; + } + + return array( + 'name' => $matches['name'], + 'orig' => "file://$subvalue/*.json", + 'path' => "{$matches['path']}/*.json", + ); + } } |