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