|mediawiki/extensions/Translate||master||+190 -27||Add backward compatibility for older version of Elastica extension|
What was done?
1. Setup ElasticSearch on my vagrant machine.
For this I had to,
- Increase the RAM for the machine - vagrant config vagrant_ram 3072; vagrant reload
When running ttmserver-export.php --reindex got the following errors,
- MySQL Server has gone away error - Modified MySQL configuration file - wait_timeout = 28800 & max_allowed_packet = 1024M
- Even after increasing the packet size, continued to have issues with MySQL server has gone away error. Finally had to set threading in ttmserver-export.php to 0. The --threads parameter did not seem to work very well. Will verify further.
Also got the following notice when running ttmserver-export.php,
- Deprecated: Use of Maintenance::error( $err, $die ) was deprecated in MediaWiki 1.31. [Called from TTMServerBootstrap::execute in /vagrant/mediawiki/extensions/Translate/scripts/ttmserver-export.php at line 89] in /vagrant/mediawiki/includes/debug/MWDebug.php on line 309
2. Setup the Elastica Extension with ElasticSearch
Followed this guide - https://www.mediawiki.org/wiki/Help:Extension:Translate/Translation_memories to setup Elasticsearch (v6.6.2) and the Elastica extension.
3. Updated code
I then updated the code in the ElasticSearchTTMServer to be backward compatible with older version of the Elastica extension using method_exists to check for newer methods.
Used the following two versions of the Elastica extension with ElasticSearch v6.6.2
Note that the test cases were run with both versions of the Elastica extension. Please find the test cases below,
TC #1 - Ran ttmserver-export.php --reindex
- Run the script ttmserver-export.php
- Added echo statements in code to identify the branch of code that was being executed.
Expected Behavior - The script should complete without throwing any warnings or errors. In addition based on the version of Elastica extension used, the branch of code executed should vary.
TC #2 - Search translation page
- Go to Special:SearchTranslations page.
- Search for a message string.
Expected Behavior - Search output should be displayed, showing message with that string in it.
You probably encountered T193008: MediaWiki\MediaWikiServices::resetChildProcessServices doesn't reset database connection state. There doesn't seem a task to fix the deprecation warning (If I remember correctly, I had used that method first, but then core also added a method with same name, creating a conflict). There is also T156035: Error when running TTMServer export with the database backend which is in the related code, but not directly related as it is a different backend.