Index: trunk/phase3/includes/Interwiki.php |
— | — | @@ -40,9 +40,7 @@ |
41 | 41 | return Interwiki::getInterwikiCached( $key ); |
42 | 42 | } |
43 | 43 | $iw = new Interwiki; |
44 | | - if(! $iw->load( $prefix ) ){ |
45 | | - return false; |
46 | | - } |
| 44 | + $iw->load( $prefix ); |
47 | 45 | if( self::CACHE_LIMIT && count( self::$smCache ) >= self::CACHE_LIMIT ){ |
48 | 46 | array_shift( self::$smCache ); |
49 | 47 | } |
— | — | @@ -86,8 +84,6 @@ |
87 | 85 | list( $local, $url ) = explode( ' ', $value, 2 ); |
88 | 86 | $s->mURL = $url; |
89 | 87 | $s->mLocal = (int)$local; |
90 | | - }else{ |
91 | | - return false; |
92 | 88 | } |
93 | 89 | if( self::CACHE_LIMIT && count( self::$smCache ) >= self::CACHE_LIMIT ){ |
94 | 90 | array_shift( self::$smCache ); |
— | — | @@ -97,6 +93,16 @@ |
98 | 94 | } |
99 | 95 | |
100 | 96 | /** |
| 97 | + * Clear all member variables in the current object. Does not clear |
| 98 | + * the block from the DB. |
| 99 | + */ |
| 100 | + function clear() { |
| 101 | + $this->mURL = ''; |
| 102 | + $this->mLocal = $this->mTrans = 0; |
| 103 | + $this->mPrefix = null; |
| 104 | + } |
| 105 | + |
| 106 | + /** |
101 | 107 | * Get the DB object |
102 | 108 | * |
103 | 109 | * @return Database |
— | — | @@ -117,19 +123,25 @@ |
118 | 124 | global $wgMemc; |
119 | 125 | $key = wfMemcKey( 'interwiki', $prefix ); |
120 | 126 | $mc = $wgMemc->get( $key ); |
121 | | - if( $mc && is_array( $mc ) && $this->loadFromArray( $mc ) ){ // is_array is hack for old keys |
122 | | - wfDebug("Succeeded\n"); |
123 | | - return true; |
| 127 | + if( $mc && is_array( $mc ) ){ // is_array is hack for old keys |
| 128 | + if( $this->loadFromArray( $mc ) ){ |
| 129 | + wfDebug("Succeeded\n"); |
| 130 | + return true; |
| 131 | + } |
| 132 | + }else{ |
| 133 | + $db =& $this->getDB(); |
| 134 | + |
| 135 | + $res = $db->resultObject( $db->select( 'interwiki', '*', array( 'iw_prefix' => $prefix ), |
| 136 | + __METHOD__ ) ); |
| 137 | + if ( $this->loadFromResult( $res ) ) { |
| 138 | + $mc = array( 'url' => $this->mURL, 'local' => $this->mLocal, 'trans' => $this->mTrans ); |
| 139 | + $wgMemc->add( $key, $mc ); |
| 140 | + return true; |
| 141 | + } |
124 | 142 | } |
125 | 143 | |
126 | | - $db =& $this->getDB(); |
127 | | - $res = $db->resultObject( $db->select( 'interwiki', '*', array( 'iw_prefix' => $prefix ), |
128 | | - __METHOD__ ) ); |
129 | | - if ( $this->loadFromResult( $res ) ) { |
130 | | - $mc = array( 'url' => $this->mURL, 'local' => $this->mLocal, 'trans' => $this->mTrans ); |
131 | | - $wgMemc->add( $key, $mc ); |
132 | | - return true; |
133 | | - } |
| 144 | + # Give up |
| 145 | + $this->clear(); |
134 | 146 | return false; |
135 | 147 | } |
136 | 148 | |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -203,18 +203,9 @@ |
204 | 204 | } |
205 | 205 | } |
206 | 206 | wfProfileOut( __METHOD__ . '-checkPageExistence' ); |
207 | | - |
208 | | - $oldquery = array(); |
209 | | - if( in_array( "forcearticlepath", $options ) && $query ){ |
210 | | - $oldquery = $query; |
211 | | - $query = array(); |
212 | | - } |
213 | 207 | |
214 | 208 | # Note: we want the href attribute first, for prettiness. |
215 | 209 | $attribs = array( 'href' => $this->linkUrl( $target, $query, $options ) ); |
216 | | - if( in_array( 'forcearticlepath', $options ) && $oldquery ){ |
217 | | - $attribs['href'] = wfAppendQuery( $attribs['href'], wfArrayToCgi( $oldquery ) ); |
218 | | - } |
219 | 210 | $attribs = array_merge( |
220 | 211 | $attribs, |
221 | 212 | $this->linkAttribs( $target, $customAttribs, $options ) |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -2054,7 +2054,7 @@ |
2055 | 2055 | # Ordinary namespace |
2056 | 2056 | $dbkey = $m[2]; |
2057 | 2057 | $this->mNamespace = $ns; |
2058 | | - } elseif( Interwiki::fetch( $p ) ) { |
| 2058 | + } elseif( new Interwiki( $p ) ) { |
2059 | 2059 | if( !$firstPass ) { |
2060 | 2060 | # Can't make a local interwiki link to an interwiki link. |
2061 | 2061 | # That's just crazy! |