- if ( !isset( $this->db ) ) {
- throw new MWException( __METHOD__ . "No database available" );
- }
- $row = $this->db->selectRow( 'text',
- [ 'old_text', 'old_flags' ],
- [ 'old_id' => $id ],
- __METHOD__ );
- $text = Revision::getRevisionText( $row );
- if ( $text === false ) {
+ $store = $this->getBlobStore();
+ $address = ( is_int( $id ) || strpos( $id, ':' ) === false )
+ ? SqlBlobStore::makeAddressFromTextId( (int)$id )
+ : $id;
+
+ try {
+ $text = $store->getBlob( $address );
+
+ $stripped = str_replace( "\r", "", $text );
+ $normalized = MediaWikiServices::getInstance()->getContentLanguage()
+ ->normalize( $stripped );
+
+ return $normalized;
+ } catch ( BlobAccessException $ex ) {
+ // XXX: log a warning?