$this->addOption( 'end', 'Ending journal ID', false, true );
$this->addOption( 'posdir', 'Directory to read/record journal positions', false, true );
$this->addOption( 'posdump', 'Just dump current journal position into the position dir.' );
+ $this->addOption( 'postime', 'For position dumps, get the ID at this time', false, true );
$this->addOption( 'verbose', 'Verbose mode', false, false, 'v' );
$this->setBatchSize( 50 );
}
if ( !$this->hasOption( 'posdir' ) ) {
$this->error( "Param posdir required!", 1 );
}
- $id = (int)$src->getJournal()->getCurrentPosition(); // default to 0
- $this->output( "Current journal position is $id.\n" );
+ if ( $this->hasOption( 'postime' ) ) {
+ $id = (int)$src->getJournal()->getPositionAtTime( $this->getOption( 'postime' ) );
+ $this->output( "Requested journal position is $id.\n" );
+ } else {
+ $id = (int)$src->getJournal()->getCurrentPosition();
+ $this->output( "Current journal position is $id.\n" );
+ }
if ( file_put_contents( $posFile, $id, LOCK_EX ) !== false ) {
$this->output( "Saved journal position file.\n" );
} else {