Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
HistoryBlobCurStub
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setLocation
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getText
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Efficient concatenated text storage.
4 *
5 * @license GPL-2.0-or-later
6 * @file
7 */
8
9// NO_NAMESPACE Compatibility with serialized objects in permanent storage
10
11use MediaWiki\MediaWikiServices;
12
13/**
14 * To speed up conversion from 1.4 to 1.5 schema, text rows can refer to the
15 * leftover cur table as the backend. This avoids expensively copying hundreds
16 * of megabytes of data during the conversion downtime.
17 */
18class HistoryBlobCurStub {
19    /** @var int */
20    public $mCurId;
21
22    /**
23     * @param int $curid The cur_id pointed to
24     */
25    public function __construct( $curid = 0 ) {
26        $this->mCurId = $curid;
27    }
28
29    /**
30     * Sets the location (cur_id) of the main object to which this object
31     * points
32     *
33     * @param int $id
34     */
35    public function setLocation( $id ) {
36        $this->mCurId = $id;
37    }
38
39    /**
40     * @return string|false
41     */
42    public function getText() {
43        $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
44        return $dbr->newSelectQueryBuilder()
45            ->select( 'cur_text' )
46            ->from( 'cur' )
47            ->where( [ 'cur_id' => $this->mCurId ] )
48            ->caller( __METHOD__ )
49            ->fetchField();
50    }
51}
52
53// Blobs generated by MediaWiki < 1.5 on PHP 4 were serialized with the
54// class name coerced to lowercase. We can improve efficiency by adding
55// autoload entries for the lowercase variants of these classes (T166759).
56// The code below is never executed, but it is picked up by the AutoloadGenerator
57// parser, which scans for class_alias() calls.
58/*
59class_alias( HistoryBlobCurStub::class, 'historyblobcurstub' );
60*/