Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
HistoryBlobCurStub | |
0.00% |
0 / 9 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setLocation | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getText | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | /** |
3 | * Efficient concatenated text storage. |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License along |
16 | * with this program; if not, write to the Free Software Foundation, Inc., |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
18 | * http://www.gnu.org/copyleft/gpl.html |
19 | * |
20 | * @file |
21 | */ |
22 | |
23 | use MediaWiki\MediaWikiServices; |
24 | |
25 | /** |
26 | * To speed up conversion from 1.4 to 1.5 schema, text rows can refer to the |
27 | * leftover cur table as the backend. This avoids expensively copying hundreds |
28 | * of megabytes of data during the conversion downtime. |
29 | */ |
30 | class HistoryBlobCurStub { |
31 | /** @var int */ |
32 | public $mCurId; |
33 | |
34 | /** |
35 | * @param int $curid The cur_id pointed to |
36 | */ |
37 | public function __construct( $curid = 0 ) { |
38 | $this->mCurId = $curid; |
39 | } |
40 | |
41 | /** |
42 | * Sets the location (cur_id) of the main object to which this object |
43 | * points |
44 | * |
45 | * @param int $id |
46 | */ |
47 | public function setLocation( $id ) { |
48 | $this->mCurId = $id; |
49 | } |
50 | |
51 | /** |
52 | * @return string|false |
53 | */ |
54 | public function getText() { |
55 | $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase(); |
56 | $row = $dbr->newSelectQueryBuilder() |
57 | ->select( [ 'cur_text' ] ) |
58 | ->from( 'cur' ) |
59 | ->where( [ 'cur_id' => $this->mCurId ] ) |
60 | ->caller( __METHOD__ )->fetchRow(); |
61 | return $row ? $row->cur_text : false; |
62 | } |
63 | } |
64 | |
65 | // Blobs generated by MediaWiki < 1.5 on PHP 4 were serialized with the |
66 | // class name coerced to lowercase. We can improve efficiency by adding |
67 | // autoload entries for the lowercase variants of these classes (T166759). |
68 | // The code below is never executed, but it is picked up by the AutoloadGenerator |
69 | // parser, which scans for class_alias() calls. |
70 | /* |
71 | class_alias( HistoryBlobCurStub::class, 'historyblobcurstub' ); |
72 | */ |