Index: trunk/extensions/Translate/MessageGroups.php |
— | — | @@ -731,31 +731,34 @@ |
732 | 732 | } |
733 | 733 | |
734 | 734 | class WikiPageMessageGroup extends WikiMessageGroup { |
735 | | - protected $type = 'mediawiki'; |
| 735 | + protected $title; |
736 | 736 | |
737 | | - public $title; |
738 | | - |
739 | 737 | public function __construct( $id, $source ) { |
740 | 738 | $this->id = $id; |
741 | | - $title = Title::newFromText( $source ); |
| 739 | + $this->title = $source; |
| 740 | + $this->namespaces = array( NS_TRANSLATIONS, NS_TRANSLATIONS_TALK ); |
| 741 | + } |
742 | 742 | |
743 | | - if ( !$title ) { |
744 | | - throw new MWException( 'Invalid title' ); |
| 743 | + public function getTitle() { |
| 744 | + if ( is_string( $this->title ) ) { |
| 745 | + $this->title = Title::newFromText( $this->title ); |
745 | 746 | } |
| 747 | + return $this->title; |
| 748 | + } |
746 | 749 | |
747 | | - $this->title = $title; |
748 | | - $this->namespaces = array( NS_TRANSLATIONS, NS_TRANSLATIONS_TALK ); |
| 750 | + public function getType() { |
| 751 | + return 'mediawiki'; |
749 | 752 | } |
750 | 753 | |
751 | 754 | public function getDefinitions() { |
752 | 755 | $dbr = wfGetDB( DB_SLAVE ); |
753 | 756 | $tables = 'translate_sections'; |
754 | 757 | $vars = array( 'trs_key', 'trs_text' ); |
755 | | - $conds = array( 'trs_page' => $this->title->getArticleId() ); |
| 758 | + $conds = array( 'trs_page' => $this->getTitle()->getArticleId() ); |
756 | 759 | $res = $dbr->select( $tables, $vars, $conds, __METHOD__ ); |
757 | 760 | |
758 | 761 | $defs = array(); |
759 | | - $prefix = $this->title->getPrefixedDBKey() . '/'; |
| 762 | + $prefix = $this->getTitle()->getPrefixedDBKey() . '/'; |
760 | 763 | $re = '~<tvar\|([^>]+)>(.*?)</>~u'; |
761 | 764 | |
762 | 765 | foreach ( $res as $r ) { |
— | — | @@ -830,6 +833,7 @@ |
831 | 834 | $target = SpecialPage::getTitleFor( 'MyLanguage', $title )->getPrefixedText(); |
832 | 835 | return wfMsgNoTrans( 'translate-tag-page-desc', $title, $target ); |
833 | 836 | } |
| 837 | + |
834 | 838 | } |
835 | 839 | |
836 | 840 | class MessageGroups { |
— | — | @@ -989,8 +993,6 @@ |
990 | 994 | public $classes; |
991 | 995 | private function __construct() { |
992 | 996 | self::init(); |
993 | | - |
994 | | - |
995 | 997 | } |
996 | 998 | |
997 | 999 | public static function singleton() { |