VuFind API Documentation

ChangeTracker extends Gateway
in package

Table Definition for change_tracker

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Site

Table of Contents

$dateFormat  : string
Date/time format for database
$tableManager  : PluginManager
Table manager
__construct()  : mixed
Constructor
beginTransaction()  : void
Begin a database transaction.
commitTransaction()  : void
Commit a database transaction.
createRow()  : object
Create a new row.
getDbTable()  : Gateway
Get access to another table.
getRetrieveDeletedCallback()  : callable
Build a callback function for use by the retrieveDeleted* methods.
index()  : ChangeTracker
Update the change_tracker table to reflect that a record has been indexed.
initializeFeatures()  : void
Initialize features
markDeleted()  : ChangeTracker
Update the change tracker table to indicate that a record has been deleted.
retrieve()  : ChangeTracker|null
Retrieve a row from the database based on primary key; return null if it is not found.
retrieveDeleted()  : AbstractResultSet
Retrieve a set of deleted rows from the database.
retrieveDeletedCount()  : AbstractResultSet
Retrieve a set of deleted rows from the database.
retrieveOrCreate()  : ChangeTracker
Retrieve a row from the database based on primary key; create a new row if no existing match is found.
rollBackTransaction()  : void
Roll back a database transaction.
getUtcDate()  : string
Get a UTC time.
strToUtcTime()  : int
Convert a string to time in UTC.

Properties

$dateFormat

Date/time format for database

protected string $dateFormat = 'Y-m-d H:i:s'

Methods

__construct()

Constructor

public __construct(Adapter $adapter, PluginManager $tm, array<string|int, mixed> $cfg[, RowGateway $rowObj = null ][, string $table = 'change_tracker' ]) : mixed
Parameters
$adapter : Adapter

Database adapter

$tm : PluginManager

Table manager

$cfg : array<string|int, mixed>

Laminas configuration

$rowObj : RowGateway = null

Row prototype object (null for default)

$table : string = 'change_tracker'

Name of database table to interface with

Return values
mixed

beginTransaction()

Begin a database transaction.

public beginTransaction() : void
Tags
throws
Exception
Return values
void

commitTransaction()

Commit a database transaction.

public commitTransaction() : void
Tags
throws
Exception
Return values
void

createRow()

Create a new row.

public createRow() : object
Return values
object

getDbTable()

Get access to another table.

public getDbTable(string $table) : Gateway
Parameters
$table : string

Table name

Return values
Gateway

getRetrieveDeletedCallback()

Build a callback function for use by the retrieveDeleted* methods.

public getRetrieveDeletedCallback(string $core, string $from, string $until, int $offset[, int $limit = null ][, array<string|int, mixed> $columns = null ][, string $order = null ]) : callable
Parameters
$core : string

The Solr core holding the record.

$from : string

The beginning date of the range to search.

$until : string

The end date of the range to search.

$offset : int

Record number to retrieve first.

$limit : int = null

Retrieval limit (null for no limit)

$columns : array<string|int, mixed> = null

Columns to retrieve (null for all)

$order : string = null

Sort order

Return values
callable

index()

Update the change_tracker table to reflect that a record has been indexed.

public index(string $core, string $id, int $change) : ChangeTracker

We need to know the date of the last change to the record (independent of its addition to the index) in order to tell the difference between a reindex of a previously-encountered record and a genuine change.

The method returns the updated/created row when complete.

Parameters
$core : string

The Solr core holding the record.

$id : string

The ID of the record being indexed.

$change : int

The timestamp of the last record change.

Return values
ChangeTracker

initializeFeatures()

Initialize features

public initializeFeatures(array<string|int, mixed> $cfg) : void
Parameters
$cfg : array<string|int, mixed>

Laminas configuration

Return values
void

markDeleted()

Update the change tracker table to indicate that a record has been deleted.

public markDeleted(string $core, string $id) : ChangeTracker

The method returns the updated/created row when complete.

Parameters
$core : string

The Solr core holding the record.

$id : string

The ID of the record being indexed.

Return values
ChangeTracker

retrieve()

Retrieve a row from the database based on primary key; return null if it is not found.

public retrieve(string $core, string $id) : ChangeTracker|null
Parameters
$core : string

The Solr core holding the record.

$id : string

The ID of the record being indexed.

Return values
ChangeTracker|null

retrieveDeleted()

Retrieve a set of deleted rows from the database.

public retrieveDeleted(string $core, string $from, string $until, int $offset[, int $limit = null ]) : AbstractResultSet
Parameters
$core : string

The Solr core holding the record.

$from : string

The beginning date of the range to search.

$until : string

The end date of the range to search.

$offset : int

Record number to retrieve first.

$limit : int = null

Retrieval limit (null for no limit)

Return values
AbstractResultSet

retrieveDeletedCount()

Retrieve a set of deleted rows from the database.

public retrieveDeletedCount(string $core, string $from, string $until) : AbstractResultSet
Parameters
$core : string

The Solr core holding the record.

$from : string

The beginning date of the range to search.

$until : string

The end date of the range to search.

Return values
AbstractResultSet

retrieveOrCreate()

Retrieve a row from the database based on primary key; create a new row if no existing match is found.

public retrieveOrCreate(string $core, string $id) : ChangeTracker
Parameters
$core : string

The Solr core holding the record.

$id : string

The ID of the record being indexed.

Return values
ChangeTracker

rollBackTransaction()

Roll back a database transaction.

public rollBackTransaction() : void
Tags
throws
Exception
Return values
void

getUtcDate()

Get a UTC time.

protected getUtcDate([int $ts = null ]) : string
Parameters
$ts : int = null

Timestamp (null for current)

Return values
string

strToUtcTime()

Convert a string to time in UTC.

protected strToUtcTime(string $str) : int
Parameters
$str : string

String to parse

Return values
int

Search results