23 return strpos( $filename,
'*' ) !==
false;
36 $pattern = $repos[$info[
'repo']];
37 unset( $info[
'repo'], $info[
'orig'] );
60 foreach ( $files as $filename => $contents ) {
61 $reader = $readerFactory->getReader( $filename );
63 $parsed = $reader->parse( $contents );
64 }
catch ( \Exception
$e ) {
65 trigger_error( __METHOD__ .
": Unable to parse messages from $filename", E_USER_WARNING );
69 foreach ( $parsed as
$code => $langMessages ) {
78 # echo "$filename with " . get_class( $reader ) . " and $c\n";
94 foreach ( $remote as $key =>
$value ) {
95 if (
isset( $blacklist[$key] ) ) {
99 if ( !
isset( $origin[$key] ) ||
$value !== $origin[$key] ) {
116 if ( $this->isDirectory( $path ) ) {
117 $files = $fetcher->fetchDirectory( $path );
119 $files = [ $path => $fetcher->fetchFile( $path ) ];
133 $components = $finder->getComponents();
135 $updatedMessages = [];
137 foreach ( $components as $key => $info ) {
138 $logger->logInfo(
"Updating component $key" );
140 $originFiles = $this->fetchFiles( $fetcherFactory, $info[
'orig'] );
141 $remotePath = $this->expandRemotePath( $info, $repos );
143 $remoteFiles = $this->fetchFiles( $fetcherFactory, $remotePath );
144 }
catch ( \Exception
$e ) {
145 $logger->logError( __METHOD__ .
": Unable to fetch messages from $remotePath" );
149 if ( $remoteFiles === [] ) {
154 $originMessages = $this->readMessages( $readerFactory, $originFiles );
155 $remoteMessages = $this->readMessages( $readerFactory, $remoteFiles );
157 if ( !
isset( $remoteMessages[
'en'] ) ) {
165 $forbiddenKeys = $this->findChangedTranslations(
166 $originMessages[
'en'],
167 $remoteMessages[
'en']
171 unset( $originMessages[
'en'], $remoteMessages[
'en'] );
174 foreach ( $remoteMessages as $language => $remoteTranslations ) {
176 $originTranslations = [];
177 if (
isset( $originMessages[$language] ) ) {
178 $originTranslations = $originMessages[$language];
181 $updatedTranslations = $this->findChangedTranslations(
188 if ( $updatedTranslations === [] ) {
192 if ( !
isset( $updatedMessages[$language] ) ) {
193 $updatedMessages[$language] = [];
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Constructs fetchers based on the repository urls.
Interface for classes which provide list of components, which should be included for l10n updates.
Constructs readers for files based on the names.
Executes the localisation update.
fetchFiles(FetcherFactory $factory, $path)
Fetches files from given Url pattern.
execute(Finder $finder, ReaderFactory $readerFactory, FetcherFactory $fetcherFactory, array $repos, $logger)
expandRemotePath( $info, $repos)
Expands repository relative path to full url with the given repository patterns.
findChangedTranslations( $origin, $remote, $blacklist=[])
Find new and changed translations in $remote and returns them.
readMessages(ReaderFactory $readerFactory, array $files)
Parses translations from given list of files.
isDirectory( $path)
Whether the path is a pattern and thus we need to use appropriate code for fetching directories.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
returning false will NOT prevent logging $e
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))