Index: trunk/phase3/includes/Interwiki.php |
— | — | @@ -17,8 +17,7 @@ |
18 | 18 | |
19 | 19 | protected $mPrefix, $mURL, $mLocal, $mTrans; |
20 | 20 | |
21 | | - function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ) |
22 | | - { |
| 21 | + function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ){ |
23 | 22 | $this->mPrefix = $prefix; |
24 | 23 | $this->mURL = $url; |
25 | 24 | $this->mLocal = $local; |
— | — | @@ -52,7 +51,7 @@ |
53 | 52 | return self::$smCache[$prefix]; |
54 | 53 | } |
55 | 54 | global $wgInterwikiCache; |
56 | | - if ($wgInterwikiCache) { |
| 55 | + if( $wgInterwikiCache ) { |
57 | 56 | $iw = Interwiki::getInterwikiCached( $prefix ); |
58 | 57 | } else { |
59 | 58 | $iw = Interwiki::load( $prefix ); |
— | — | @@ -67,7 +66,7 @@ |
68 | 67 | self::$smCache[$prefix] = $iw; |
69 | 68 | return $iw; |
70 | 69 | } |
71 | | - |
| 70 | + |
72 | 71 | /** |
73 | 72 | * Fetch interwiki prefix data from local cache in constant database. |
74 | 73 | * |
— | — | @@ -78,19 +77,19 @@ |
79 | 78 | */ |
80 | 79 | protected static function getInterwikiCached( $prefix ) { |
81 | 80 | $value = self::getInterwikiCacheEntry( $prefix ); |
82 | | - |
| 81 | + |
83 | 82 | $s = new Interwiki( $prefix ); |
84 | 83 | if ( $value != '' ) { |
85 | 84 | // Split values |
86 | 85 | list( $local, $url ) = explode( ' ', $value, 2 ); |
87 | 86 | $s->mURL = $url; |
88 | 87 | $s->mLocal = (int)$local; |
89 | | - }else{ |
| 88 | + } else { |
90 | 89 | $s = false; |
91 | 90 | } |
92 | 91 | return $s; |
93 | 92 | } |
94 | | - |
| 93 | + |
95 | 94 | /** |
96 | 95 | * Get entry from interwiki cache |
97 | 96 | * |
— | — | @@ -110,11 +109,11 @@ |
111 | 110 | /* Resolve site name */ |
112 | 111 | if( $wgInterwikiScopes>=3 && !$site ) { |
113 | 112 | $site = dba_fetch( '__sites:' . wfWikiID(), $db ); |
114 | | - if ( $site == "" ){ |
| 113 | + if ( $site == '' ){ |
115 | 114 | $site = $wgInterwikiFallbackSite; |
116 | 115 | } |
117 | 116 | } |
118 | | - |
| 117 | + |
119 | 118 | $value = dba_fetch( wfMemcKey( $prefix ), $db ); |
120 | 119 | // Site level |
121 | 120 | if ( $value == '' && $wgInterwikiScopes >= 3 ) { |
— | — | @@ -126,7 +125,7 @@ |
127 | 126 | } |
128 | 127 | if ( $value == 'undef' ) |
129 | 128 | $value = ''; |
130 | | - |
| 129 | + |
131 | 130 | return $value; |
132 | 131 | } |
133 | 132 | |
— | — | @@ -136,7 +135,6 @@ |
137 | 136 | * @param $prefix The interwiki prefix |
138 | 137 | * @return bool The prefix is valid |
139 | 138 | * @static |
140 | | - * |
141 | 139 | */ |
142 | 140 | protected static function load( $prefix ) { |
143 | 141 | global $wgMemc, $wgInterwikiExpiry; |
— | — | @@ -149,9 +147,9 @@ |
150 | 148 | return $iw; |
151 | 149 | } |
152 | 150 | } |
153 | | - |
| 151 | + |
154 | 152 | $db = wfGetDB( DB_SLAVE ); |
155 | | - |
| 153 | + |
156 | 154 | $row = $db->fetchRow( $db->select( 'interwiki', '*', array( 'iw_prefix' => $prefix ), |
157 | 155 | __METHOD__ ) ); |
158 | 156 | $iw = Interwiki::loadFromArray( $row ); |
— | — | @@ -160,7 +158,7 @@ |
161 | 159 | $wgMemc->add( $key, $mc, $wgInterwikiExpiry ); |
162 | 160 | return $iw; |
163 | 161 | } |
164 | | - |
| 162 | + |
165 | 163 | return false; |
166 | 164 | } |
167 | 165 | |
— | — | @@ -181,8 +179,8 @@ |
182 | 180 | } |
183 | 181 | return false; |
184 | 182 | } |
185 | | - |
186 | | - /** |
| 183 | + |
| 184 | + /** |
187 | 185 | * Get the URL for a particular title (or with $1 if no title given) |
188 | 186 | * |
189 | 187 | * @param $title string What text to put for the article name |
— | — | @@ -195,11 +193,11 @@ |
196 | 194 | } |
197 | 195 | return $url; |
198 | 196 | } |
199 | | - |
| 197 | + |
200 | 198 | function isLocal(){ |
201 | 199 | return $this->mLocal; |
202 | 200 | } |
203 | | - |
| 201 | + |
204 | 202 | function isTranscludable(){ |
205 | 203 | return $this->mTrans; |
206 | 204 | } |