r107548 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107547‎ | r107548 | r107549 >
Date:23:52, 28 December 2011
Author:krinkle
Status:ok
Tags:
Comment:
[Toolserver Intuition] Revert r107542, 107543
* Wasn't the problem, not by a long shot. And caused other bugs where other requests for that domain would fail because this 'ignore-msgs' variant already marked the domain as loaded.
Modified paths:
  • /trunk/tools/ToolserverI18N/TsIntuition.php (modified) (history)
  • /trunk/tools/ToolserverI18N/public_html/index.php (modified) (history)

Diff [purge]

Index: trunk/tools/ToolserverI18N/TsIntuition.php
@@ -645,11 +645,9 @@
646646 * Load a textdomain (if not loaded already).
647647 *
648648 * @param $domain string Name of the textdomain (case-insensitive)
649 - * @param $msgAction string What to do with the messages from the text domain
650 - * one of 'register', 'ignore'.
651649 * @return False on error, (normalized) domainname if success.
652650 */
653 - public function loadTextdomain( $domain, $msgAction = 'register' ) {
 651+ public function loadTextdomain( $domain ) {
654652
655653 // Generally validate input and protect against path traversal
656654 if ( !TsIntuitionUtil::nonEmptyStr( $domain ) || strcspn( $domain, ":/\\\000" ) !== strlen( $domain ) ) {
@@ -678,7 +676,7 @@
679677 }
680678
681679 // Load it
682 - $load = $this->loadTextdomainFromFile( $path, $domain, $msgAction );
 680+ $load = $this->loadTextdomainFromFile( $path, $domain );
683681
684682 // Return (normalized) domainname or false
685683 return !!$load ? $domain : false;
@@ -688,7 +686,7 @@
689687 /**
690688 * @DOCME:
691689 */
692 - public function loadTextdomainFromFile( $filePath = '', $domain = '', $msgAction = 'register' ) {
 690+ public function loadTextdomainFromFile( $filePath = '', $domain = '' ) {
693691 if ( !TsIntuitionUtil::nonEmptyStrs( $filePath, $domain ) ) {
694692 $this->errTrigger( 'One or more arguments are missing', __METHOD__, E_NOTICE, __FILE__, __LINE__ );
695693 return false;
@@ -704,14 +702,14 @@
705703
706704 // Parse it
707705 $compact = compact( $this->includeVariables );
708 - $this->parseTextdomain( $compact, $domain, $filePath, $msgAction );
 706+ $this->parseTextdomain( $compact, $domain, $filePath );
709707 return true;
710708 }
711709
712710 /**
713711 * @DOCME:
714712 */
715 - private function parseTextdomain( $data, $domain, $filePath, $msgAction ) {
 713+ private function parseTextdomain( $data, $domain, $filePath ) {
716714 if ( !is_array( $data ) ) {
717715 $this->errTrigger( 'Invalid $data passed to ' . __FUNCTION__,
718716 __METHOD__, E_ERROR, __FILE__, __LINE__ );
@@ -723,19 +721,13 @@
724722 }
725723 unset( $data['messages']['qqq'] ); // Workaround
726724
727 - if ( $msgAction === 'register' ) {
728 - // Load the message into the blob
729 - // overwrites the existing array of messages if it already existed
730 - // If you need to add or overwrite some messages temporarily,
731 - // use Itui::setMsg() or Itui::setMsgs() instead
732 - foreach ( $data['messages'] as $langCode => $messages ) {
733 - $this->availableLanguages[$langCode] = true;
734 - $this->setMsgs( (array)$messages, $domain, $langCode );
735 - }
736 - } else {
737 - foreach ( array_keys( $data['messages'] ) as $langCode ) {
738 - $this->availableLanguages[$langCode] = true;
739 - }
 725+ // Load the message into the blob
 726+ // overwrites the existing array of messages if it already existed
 727+ // If you need to add or overwrite some messages temporarily,
 728+ // use Itui::setMsg() or Itui::setMsgs() instead
 729+ foreach ( $data['messages'] as $langcode => $messages ) {
 730+ $this->availableLanguages[$langcode] = true;
 731+ $this->setMsgs( (array)$messages, $domain, $langcode );
740732 }
741733
742734 // Was there a url defined in the textdomain file ?
Index: trunk/tools/ToolserverI18N/public_html/index.php
@@ -36,7 +36,7 @@
3737 // Load all domains so we can get some statistics later on and
3838 // make sure "getAvailableLangs" is complete
3939 foreach ( $I18N->getAllRegisteredDomains() as $domainKey => $domainInfo ) {
40 - $I18N->loadTextdomain( $domainKey, 'ignore' );
 40+ $I18N->loadTextdomain( $domainKey );
4141 }
4242
4343 /* Initialize BaseTool */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107542[Toolserver Intuition] Address memory usage problem for preferences page...krinkle23:12, 28 December 2011

Status & tagging log