Index: trunk/phase3/includes/HistoryBlob.php |
— | — | @@ -137,20 +137,20 @@ |
138 | 138 | } |
139 | 139 | |
140 | 140 | |
141 | | -/** |
142 | | - * One-step cache variable to hold base blobs; operations that |
143 | | - * pull multiple revisions may often pull multiple times from |
144 | | - * the same blob. By keeping the last-used one open, we avoid |
145 | | - * redundant unserialization and decompression overhead. |
146 | | - */ |
147 | | -global $wgBlobCache; |
148 | | -$wgBlobCache = array(); |
149 | 141 | |
150 | 142 | |
151 | 143 | /** |
152 | 144 | * Pointer object for an item within a CGZ blob stored in the text table. |
153 | 145 | */ |
154 | 146 | class HistoryBlobStub { |
| 147 | + /** |
| 148 | + * One-step cache variable to hold base blobs; operations that |
| 149 | + * pull multiple revisions may often pull multiple times from |
| 150 | + * the same blob. By keeping the last-used one open, we avoid |
| 151 | + * redundant unserialization and decompression overhead. |
| 152 | + */ |
| 153 | + protected static $blobCache = array(); |
| 154 | + |
155 | 155 | var $mOldId, $mHash, $mRef; |
156 | 156 | |
157 | 157 | /** |
— | — | @@ -185,9 +185,9 @@ |
186 | 186 | |
187 | 187 | function getText() { |
188 | 188 | $fname = 'HistoryBlobStub::getText'; |
189 | | - global $wgBlobCache; |
190 | | - if( isset( $wgBlobCache[$this->mOldId] ) ) { |
191 | | - $obj = $wgBlobCache[$this->mOldId]; |
| 189 | + |
| 190 | + if( isset( self::$blobCache[$this->mOldId] ) ) { |
| 191 | + $obj = self::$blobCache[$this->mOldId]; |
192 | 192 | } else { |
193 | 193 | $dbr = wfGetDB( DB_SLAVE ); |
194 | 194 | $row = $dbr->selectRow( 'text', array( 'old_flags', 'old_text' ), array( 'old_id' => $this->mOldId ) ); |
— | — | @@ -225,7 +225,7 @@ |
226 | 226 | // Save this item for reference; if pulling many |
227 | 227 | // items in a row we'll likely use it again. |
228 | 228 | $obj->uncompress(); |
229 | | - $wgBlobCache = array( $this->mOldId => $obj ); |
| 229 | + self::$blobCache = array( $this->mOldId => $obj ); |
230 | 230 | } |
231 | 231 | return $obj->getItem( $this->mHash ); |
232 | 232 | } |