Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72626285
HarbormasterBuildLogChunkIterator.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, 06:34
Size
964 B
Mime Type
text/x-php
Expires
Thu, Jul 18, 06:34 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
19075082
Attached To
rPH Phabricator
HarbormasterBuildLogChunkIterator.php
View Options
<?php
final
class
HarbormasterBuildLogChunkIterator
extends
PhutilBufferedIterator
{
private
$log
;
private
$cursor
;
private
$min
=
0
;
private
$max
=
PHP_INT_MAX
;
public
function
__construct
(
HarbormasterBuildLog
$log
)
{
$this
->
log
=
$log
;
}
protected
function
didRewind
()
{
$this
->
cursor
=
$this
->
min
;
}
public
function
key
()
{
return
$this
->
current
()->
getID
();
}
public
function
setRange
(
$min
,
$max
)
{
$this
->
min
=
(
int
)
$min
;
$this
->
max
=
(
int
)
$max
;
return
$this
;
}
protected
function
loadPage
()
{
if
(
$this
->
cursor
>
$this
->
max
)
{
return
array
();
}
$results
=
id
(
new
HarbormasterBuildLogChunk
())->
loadAllWhere
(
'logID = %d AND id >= %d AND id <= %d ORDER BY id ASC LIMIT %d'
,
$this
->
log
->
getID
(),
$this
->
cursor
,
$this
->
max
,
$this
->
getPageSize
());
if
(
$results
)
{
$this
->
cursor
=
last
(
$results
)->
getID
()
+
1
;
}
return
$results
;
}
}
Event Timeline
Log In to Comment