Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72600698
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, Jul 16, 02:29
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jul 18, 02:29 (2 d)
Engine
blob
Format
Raw Data
Handle
19075356
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