Index: trunk/extensions/SiteMatrix/SiteMatrixApi.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | 'name' => $langNames[$lang], |
50 | 50 | 'site' => array(), |
51 | 51 | ); |
52 | | - if( isset( $localLanguageNames[$lang] ) ) { |
| 52 | + if ( isset( $localLanguageNames[$lang] ) ) { |
53 | 53 | $language['localname'] = $localLanguageNames[$lang]; |
54 | 54 | } |
55 | 55 | |
— | — | @@ -63,9 +63,10 @@ |
64 | 64 | $url = $matrix->getUrl( $lang, $site ); |
65 | 65 | $site_out = array( |
66 | 66 | 'url' => $url, |
| 67 | + 'dbname' => $matrix->getDBName( $lang, $site ), |
67 | 68 | 'code' => $site, |
68 | 69 | ); |
69 | | - if( $matrix->isClosed( $lang, $site ) ) { |
| 70 | + if ( $matrix->isClosed( $lang, $site ) ) { |
70 | 71 | $site_out['closed'] = ''; |
71 | 72 | if ( $closed ) { |
72 | 73 | $skip = false; |
— | — | @@ -96,6 +97,7 @@ |
97 | 98 | |
98 | 99 | $wiki = array(); |
99 | 100 | $wiki['url'] = $url; |
| 101 | + $wiki['dbname'] = $matrix->getDBName( $lang, $site ); |
100 | 102 | $wiki['code'] = str_replace( '_', '-', $lang ) . ( $site != 'wiki' ? $site : '' ); |
101 | 103 | |
102 | 104 | $skip = true; |
Index: trunk/extensions/SiteMatrix/SiteMatrix_body.php |
— | — | @@ -133,13 +133,22 @@ |
134 | 134 | */ |
135 | 135 | public function getUrl( $minor, $major ){ |
136 | 136 | global $wgConf; |
137 | | - $dbname = $minor . $major; |
| 137 | + $dbname = $this->getDBName( $minor, $major ); |
138 | 138 | $minor = str_replace( '_', '-', $minor ); |
139 | 139 | return $wgConf->get( 'wgServer', $dbname, $major, |
140 | 140 | array( 'lang' => $minor, 'site' => $major ) ); |
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
| 144 | + * @param $minor string |
| 145 | + * @param $major string |
| 146 | + * @return string |
| 147 | + */ |
| 148 | + public function getDBName( $minor, $major ) { |
| 149 | + return $minor . $major; |
| 150 | + } |
| 151 | + |
| 152 | + /** |
144 | 153 | * @param string $minor Language |
145 | 154 | * @param string $major Site |
146 | 155 | * @return bool |
— | — | @@ -156,7 +165,7 @@ |
157 | 166 | public function isClosed( $minor, $major ) { |
158 | 167 | global $wgSiteMatrixClosedSites; |
159 | 168 | |
160 | | - $dbname = $minor . $major; |
| 169 | + $dbname = $this->getDBName( $minor, $major ); |
161 | 170 | |
162 | 171 | if ( $wgSiteMatrixClosedSites === null ) { |
163 | 172 | // Fallback to old behavior checking read-only settings; |