Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4106056
TemplateDataCompressedBlob.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
TemplateDataCompressedBlob.php
View Options
<?php
namespace
MediaWiki\Extension\TemplateData
;
use
MediaWiki\Message\Message
;
/**
* Represents the information about a template,
* coming from the JSON blob in the <templatedata> tags
* on wiki pages.
* This implementation stores the information as a compressed gzip blob
* in the database.
* @license GPL-2.0-or-later
*/
class
TemplateDataCompressedBlob
extends
TemplateDataBlob
{
// Size of MySQL 'blob' field; page_props table where the data is stored uses one.
private
const
MAX_LENGTH
=
65535
;
/**
* @var string In-object cache for {@see getJSONForDatabase}
*/
private
string
$jsonDB
;
/**
* @inheritDoc
*/
protected
function
__construct
(
string
$json
,
string
$lang
)
{
parent
::
__construct
(
$json
,
$lang
);
$this
->
jsonDB
=
gzencode
(
$this
->
json
);
$length
=
strlen
(
$this
->
jsonDB
);
if
(
$length
>
self
::
MAX_LENGTH
)
{
$this
->
status
->
fatal
(
'templatedata-invalid-length'
,
Message
::
numParam
(
$length
),
Message
::
numParam
(
self
::
MAX_LENGTH
)
);
}
}
/**
* @return string JSON (gzip compressed)
*/
public
function
getJSONForDatabase
():
string
{
return
$this
->
jsonDB
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 19:17 (2 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
64/18/032f7dee093a830e6734a022440e
Default Alt Text
TemplateDataCompressedBlob.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment