Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F83478017
HarbormasterBuildLogChunk.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Sep 17, 08:54
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Sep 19, 08:54 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20845094
Attached To
rPH Phabricator
HarbormasterBuildLogChunk.php
View Options
<?php
final
class
HarbormasterBuildLogChunk
extends
HarbormasterDAO
{
protected
$logID
;
protected
$encoding
;
protected
$size
;
protected
$chunk
;
const
CHUNK_ENCODING_TEXT
=
'text'
;
const
CHUNK_ENCODING_GZIP
=
'gzip'
;
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_TIMESTAMPS
=>
false
,
self
::
CONFIG_BINARY
=>
array
(
'chunk'
=>
true
,
),
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'logID'
=>
'id'
,
'encoding'
=>
'text32'
,
// T6203/NULLABILITY
// Both the type and nullability of this column are crazily wrong.
'size'
=>
'uint32?'
,
'chunk'
=>
'bytes'
,
),
self
::
CONFIG_KEY_SCHEMA
=>
array
(
'key_log'
=>
array
(
'columns'
=>
array
(
'logID'
),
),
),
)
+
parent
::
getConfiguration
();
}
public
function
getChunkDisplayText
()
{
$data
=
$this
->
getChunk
();
$encoding
=
$this
->
getEncoding
();
switch
(
$encoding
)
{
case
self
::
CHUNK_ENCODING_TEXT
:
// Do nothing, data is already plaintext.
break
;
case
self
::
CHUNK_ENCODING_GZIP
:
$data
=
gzinflate
(
$data
);
if
(
$data
===
false
)
{
throw
new
Exception
(
pht
(
'Unable to inflate log chunk!'
));
}
break
;
default
:
throw
new
Exception
(
pht
(
'Unknown log chunk encoding ("%s")!'
,
$encoding
));
}
return
$data
;
}
}
Event Timeline
Log In to Comment